:root {
  color-scheme: light;
  --paper: #f3eee4;
  --paper-deep: #e7ddcd;
  --ink: #1d2923;
  --muted: #6c756f;
  --accent: #9b482d;
  --line: rgba(29, 41, 35, 0.16);
  --card: rgba(255, 252, 246, 0.7);
  font-family: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 255, 255, 0.85), transparent 30rem),
    linear-gradient(145deg, var(--paper), var(--paper-deep));
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  pointer-events: none;
}

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fffaf1;
  background: var(--accent);
  border-radius: 50%;
  font: 600 26px/1 "Playfair Display", serif;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(36px, 7vw, 92px) 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(310px, 0.92fr);
  gap: clamp(28px, 6vw, 86px);
  align-items: center;
}

.quote-panel { min-width: 0; }

.eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(34px, 6vw, 74px);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
#today {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.loading { color: var(--muted); }

.quote { margin: 0; }

blockquote {
  position: relative;
  margin: 0 0 36px;
  font: 500 clamp(2.05rem, 4.6vw, 4.7rem)/1.08 "Playfair Display", Georgia, serif;
  letter-spacing: -0.035em;
}

blockquote::before {
  position: absolute;
  top: -0.42em;
  left: -0.38em;
  color: var(--accent);
  content: "“";
  font-size: 1.45em;
  opacity: 0.35;
}

.author {
  margin: 0;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 600;
}

.work {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: "Playfair Display", serif;
  font-style: italic;
}

.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}

.categories li {
  padding: 7px 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
}

.image-panel {
  position: relative;
  overflow: hidden;
  min-height: min(66vh, 690px);
  background: radial-gradient(circle at 50% 38%, #59645d, #29312d 72%);
  border-radius: 28px 28px 140px 28px;
  box-shadow: 0 28px 65px rgba(49, 39, 29, 0.18);
}

.image-panel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: clamp(12px, 2vw, 24px);
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.24));
}

.image-panel::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(29, 41, 35, 0.02), rgba(29, 41, 35, 0.12));
  pointer-events: none;
}

.image-placeholder {
  display: grid;
  position: absolute;
  inset: 0;
  place-items: center;
  color: rgba(255, 250, 241, 0.66);
  font: 600 15rem/1 "Playfair Display", serif;
}

.has-image .image-placeholder { display: none; }

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 34px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}

footer p { margin: 0; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .image-panel { min-height: 52vh; border-radius: 22px 22px 90px 22px; }
  .eyebrow-row { margin-bottom: 42px; }
}

@media (max-width: 520px) {
  .site-header,
  main,
  footer { width: min(100% - 28px, 1180px); }
  .site-header { padding: 20px 0; }
  main { padding-top: 24px; }
  .image-panel { min-height: 42vh; }
  blockquote { font-size: clamp(1.85rem, 9vw, 2.8rem); }
  #today { text-align: right; }
}

@media (prefers-reduced-motion: no-preference) {
  .quote-panel,
  .image-panel {
    animation: arrive 700ms cubic-bezier(.2,.75,.2,1) both;
  }
  .image-panel { animation-delay: 100ms; }
  @keyframes arrive {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

.site-header {
  display: grid;
  grid-template-columns: minmax(180px, 270px) minmax(280px, 560px) auto;
  gap: clamp(24px, 6vw, 80px);
  align-items: center;
}

.brand-logo {
  display: block;
  width: min(100%, 270px);
  height: auto;
  filter: grayscale(1) sepia(0.12) saturate(0.6) brightness(0.43);
}

.site-subtitle {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  font: 500 clamp(0.9rem, 1.5vw, 1.05rem)/1.55 "Playfair Display", Georgia, serif;
}

.app-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.pwa-toast button {
  appearance: none;
  padding: 10px 14px;
  color: #fffaf1;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  font: 600 0.78rem/1 "DM Sans", sans-serif;
  cursor: pointer;
}

.connection-status {
  margin: 0;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
}

.pwa-toast {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  max-width: min(440px, calc(100% - 32px));
  align-items: center;
  gap: 12px;
  padding: 13px 14px 13px 18px;
  color: #fffaf1;
  background: var(--ink);
  border-radius: 18px;
  box-shadow: 0 16px 45px rgba(29, 41, 35, 0.28);
  font-size: 0.84rem;
}

.pwa-toast[hidden] { display: none; }

.pwa-toast button {
  color: var(--ink);
  background: #fffaf1;
  border-color: #fffaf1;
}

.pwa-toast .pwa-toast-close {
  padding-inline: 4px;
  color: #fffaf1;
  background: transparent;
  border-color: transparent;
}

.share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.share-label {
  width: 100%;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.share-button {
  appearance: none;
  padding: 9px 13px;
  color: #fffaf1;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  font: 600 0.78rem/1 "DM Sans", sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.share-button:hover {
  color: var(--ink);
  background: transparent;
  transform: translateY(-1px);
}

.share-button-secondary {
  color: var(--ink);
  background: transparent;
}

.share-button-secondary:hover {
  color: #fffaf1;
  background: var(--ink);
}

.share-status {
  min-height: 1em;
  color: var(--accent);
  font-size: 0.76rem;
}

.project-story {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: clamp(36px, 8vw, 120px);
  margin-top: clamp(72px, 11vw, 150px);
  padding: clamp(42px, 7vw, 82px) 0;
  border-top: 1px solid var(--line);
}

.story-heading .eyebrow {
  margin-bottom: 18px;
}

.story-heading h2 {
  max-width: 9ch;
  margin: 0;
  font: 600 clamp(2.15rem, 4.4vw, 4.3rem)/1.04 "Playfair Display", Georgia, serif;
  letter-spacing: -0.04em;
}

.story-copy {
  max-width: 650px;
  color: #38443e;
  font: 400 clamp(1.08rem, 1.75vw, 1.35rem)/1.75 "Playfair Display", Georgia, serif;
}

.story-copy p {
  margin: 0;
}

.story-copy p + p {
  margin-top: 1.4em;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.install-app {
  appearance: none;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  color: #fffaf1;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 3px 0 #6e301e, 0 5px 12px rgba(155, 72, 45, 0.16);
  font: 600 0.76rem/1.2 "DM Sans", sans-serif;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.install-app[hidden] { display: none; }

.install-app svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.install-app:hover { background: #873d27; }

.install-app:active {
  box-shadow: 0 1px 0 #6e301e;
  transform: translateY(2px);
}

.install-app:focus-visible,
.install-dialog button:focus-visible {
  outline: 3px solid rgba(155, 72, 45, 0.34);
  outline-offset: 3px;
}

.install-app:disabled {
  opacity: 0.58;
  cursor: wait;
}

.install-dialog {
  box-sizing: border-box;
  width: min(460px, calc(100% - 32px));
  max-height: 85svh;
  margin: auto;
  padding: 26px;
  color: var(--ink);
  background: #fffaf1;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(29, 41, 35, 0.25);
  text-align: left;
}

.install-dialog::backdrop { background: rgba(29, 41, 35, 0.5); }

.install-dialog h2 {
  margin: 0 0 18px;
  font: 600 1.65rem/1.2 "Playfair Display", Georgia, serif;
}

.install-dialog p {
  margin: 0 0 14px;
  color: #38443e;
  font-size: 0.92rem;
  line-height: 1.6;
}

.install-dialog p:last-of-type {
  color: var(--muted);
  font-size: 0.8rem;
}

.install-dialog button {
  appearance: none;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  color: #fffaf1;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 12px;
  font: 600 0.84rem/1 "DM Sans", sans-serif;
  cursor: pointer;
}

@media (max-width: 820px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .app-controls { align-items: flex-start; }

  .brand-logo {
    width: min(240px, 80vw);
  }

  .site-subtitle {
    max-width: 48ch;
  }

  .project-story {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .story-heading h2 {
    max-width: 13ch;
  }
}

@media (max-width: 520px) {
  .share-button {
    padding: 10px 12px;
  }

  footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-actions {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
  }
}
