:root {
  color-scheme: light;
  --ink: #302229;
  --wine: #6f3650;
  --wine-dark: #4b2236;
  --rose: #c9999f;
  --paper: #fbf7f2;
  --paper-deep: #f1e4dc;
  --line: rgba(75, 34, 54, .18);
  --shadow: 0 28px 70px rgba(75, 34, 54, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
.home-page {
  background-color: #5f302f;
  background-image: linear-gradient(180deg, rgba(46,24,31,.13), rgba(46,24,31,.23)), url("/assets/askjanie-1080p.png");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}
a { color: inherit; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.paper-noise { position: fixed; inset: 0; pointer-events: none; opacity: .32; z-index: -1; background-image: radial-gradient(rgba(111,54,80,.14) .55px, transparent .55px); background-size: 5px 5px; mask-image: linear-gradient(to bottom, #000, transparent 75%); }
.site-header, main, footer { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.site-header { min-height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.home-page .site-header { border-bottom-color: rgba(255,255,255,.36); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--wine-dark); text-decoration: none; font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.brand img { border-radius: 13px; }
.j-account-button { width: 46px; height: 46px; display: inline-grid; place-items: center; color: #fffaf6; background: var(--wine); border: 1px solid var(--wine); border-radius: 50%; box-shadow: 0 7px 20px rgba(75,34,54,.16); text-decoration: none; font: 700 1.45rem/1 Georgia, "Times New Roman", serif; transition: transform .18s ease, box-shadow .18s ease; }
.j-account-button:hover { transform: translateY(-2px) rotate(-4deg); box-shadow: 0 11px 24px rgba(75,34,54,.22); }
nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 38px); }
nav a, .text-button, .link-button { padding: 6px 0; color: var(--wine-dark); background: none; border: 0; text-decoration: none; font-size: .86rem; font-weight: 750; cursor: pointer; }
nav a:hover, .text-button:hover, .link-button:hover { color: var(--wine); text-decoration: underline; text-underline-offset: 5px; }

.hero { min-height: 660px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(310px, .8fr); align-items: center; gap: clamp(50px, 9vw, 140px); padding: 72px 5vw 92px; position: relative; }
.hero::before { content: ""; position: absolute; width: 440px; height: 440px; right: 1%; top: 12%; border-radius: 50%; background: radial-gradient(circle, rgba(201,153,159,.23), rgba(201,153,159,0) 67%); z-index: -1; }
.home-page .hero { min-height: calc(100vh - 108px); align-items: start; padding-top: clamp(48px, 8vh, 90px); }
.home-page .hero::before { display: none; }
.home-page .hero-copy {
  max-width: 590px;
  padding: clamp(26px, 3.8vw, 46px);
  background: rgba(251,247,242,.82);
  border: 1px solid rgba(255,255,255,.64);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(35,18,27,.24);
  backdrop-filter: blur(15px);
}
.home-page .hero-copy h1 { font-size: clamp(3.2rem, 5.7vw, 6rem); }
.home-page .hero-copy .lede { margin-bottom: 0; }
.eyebrow { margin: 0 0 18px; color: var(--wine); font-size: .72rem; font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; color: var(--wine-dark); font-weight: 500; letter-spacing: -.045em; }
h1 { max-width: 720px; margin: 0; font-size: clamp(3.5rem, 7.4vw, 7.2rem); line-height: .92; }
.lede { max-width: 620px; margin: 30px 0; color: #66545d; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.15rem, 2vw, 1.48rem); line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button { min-height: 48px; display: inline-flex; justify-content: center; align-items: center; padding: 0 22px; border: 1px solid var(--wine); border-radius: 999px; text-decoration: none; font-size: .82rem; font-weight: 800; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(75,34,54,.13); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { color: #fffaf6; background: var(--wine); }
.button.quiet { color: var(--wine); background: rgba(255,255,255,.45); }

.letter-card { min-height: 410px; padding: 66px 52px 48px; display: flex; flex-direction: column; justify-content: center; color: #fdf8f4; background: var(--wine-dark); border: 12px solid #ead8d1; outline: 1px solid rgba(75,34,54,.28); box-shadow: var(--shadow); transform: rotate(2.2deg); position: relative; }
.letter-card::after { content: "J"; position: absolute; right: 20px; bottom: 5px; color: rgba(255,255,255,.055); font: 240px/1 Georgia, serif; }
.letter-card p { position: relative; z-index: 1; margin: 0 0 22px; font: italic 1.4rem/1.55 Georgia, serif; }
.postmark { margin-bottom: 36px; color: #e0bdc3; font-size: .65rem; font-weight: 800; letter-spacing: .16em; }
.signature { position: relative; z-index: 1; margin-top: 22px; color: #e8cad0; font: italic 1.08rem/1.5 Georgia, serif; }

.principles { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); }
.home-page .principles {
  overflow: hidden;
  background: rgba(251,247,242,.91);
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 28px;
  box-shadow: 0 22px 65px rgba(35,18,27,.18);
  backdrop-filter: blur(16px);
}
.principles article { padding: 50px clamp(24px, 4vw, 52px) 56px; }
.principles article + article { border-left: 1px solid var(--line); }
.principles span { color: var(--rose); font: italic 1rem Georgia, serif; }
.principles h2 { margin: 40px 0 12px; font-size: 2rem; }
.principles p { margin: 0; color: #705e66; line-height: 1.72; }

.foundation { margin-block: 110px; padding: clamp(38px, 6vw, 72px); display: grid; grid-template-columns: 1fr 1fr; gap: 36px 9vw; background: #efe1d9; border-radius: 30px; }
.home-page .foundation { background: rgba(239,225,217,.92); box-shadow: 0 22px 65px rgba(35,18,27,.18); backdrop-filter: blur(16px); }
.foundation h2 { margin: 0; font-size: clamp(2.5rem, 5vw, 4.8rem); line-height: 1; }
.foundation > p { margin: 30px 0 0; color: #65535c; font-size: 1.08rem; line-height: 1.75; }
.status-line { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; padding-top: 28px; border-top: 1px solid var(--line); color: #6c5962; font-size: .78rem; font-weight: 750; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #b38b52; box-shadow: 0 0 0 4px rgba(179,139,82,.12); }
.status-dot.online { background: #4b8b6d; box-shadow: 0 0 0 4px rgba(75,139,109,.12); }

footer { min-height: 130px; display: flex; align-items: center; gap: 28px; border-top: 1px solid var(--line); color: #7a6870; font-size: .76rem; }
.home-page footer { margin-bottom: 24px; padding-inline: 24px; color: #4b303c; background: rgba(251,247,242,.82); border: 1px solid rgba(255,255,255,.66); border-radius: 24px; backdrop-filter: blur(15px); }
.footer-brand { margin-right: auto; font-size: 1.05rem; }
.technical-note { color: #9b858e; }

.interior-page { background: linear-gradient(125deg, var(--paper), #f4e8e2); }
.story-page { padding: clamp(80px, 12vw, 150px) clamp(0px, 6vw, 90px); }
.story-page h1 { max-width: 960px; font-size: clamp(3.3rem, 7vw, 7rem); }
.story-grid { margin: 78px 0 55px; display: grid; grid-template-columns: 1fr 1fr; gap: 8vw; border-top: 1px solid var(--line); padding-top: 46px; }
.story-grid p { color: #65535c; font: 1.08rem/1.8 Georgia, serif; }
.story-grid .dropcap::first-letter { float: left; margin: .1em .12em 0 0; color: var(--wine); font-size: 4.6em; line-height: .72; }

.account-page { min-height: calc(100vh - 218px); padding: 84px clamp(0px, 3vw, 48px); display: grid; grid-template-columns: minmax(280px, .65fr) minmax(580px, 1.35fr); gap: 6vw; align-items: center; }
.account-copy h1 { font-size: clamp(4rem, 8vw, 7.4rem); }
.account-copy > p:last-child { max-width: 540px; color: #6c5962; font: 1.15rem/1.7 Georgia, serif; }
.account-card { padding: clamp(30px, 5vw, 52px); background: rgba(255,255,255,.64); border: 1px solid rgba(111,54,80,.15); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.account-card h2, .account-dialog h2 { margin: 0 0 24px; font-size: 2.3rem; }
.auth-card { padding: 0; overflow: hidden; }
.auth-choice-grid { display: grid; grid-template-columns: 1fr 1fr; }
.auth-panel { padding: clamp(30px, 4vw, 50px); }
.auth-panel + .auth-panel { border-left: 1px solid var(--line); }
.sign-in-panel { background: rgba(239,225,217,.5); }
.sign-in-panel > p:not(.eyebrow) { min-height: 3.4em; margin: -10px 0 22px; color: #75626b; font-size: .88rem; line-height: 1.55; }
form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: var(--wine-dark); font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
input { width: 100%; min-height: 48px; padding: 0 14px; color: var(--ink); background: #fffdfa; border: 1px solid rgba(75,34,54,.22); border-radius: 12px; outline: none; }
input:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(111,54,80,.1); }
textarea { width: 100%; padding: 14px; color: var(--ink); background: #fffdfa; border: 1px solid rgba(75,34,54,.22); border-radius: 12px; outline: none; resize: vertical; line-height: 1.55; }
textarea:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(111,54,80,.1); }
.form-message { min-height: 1.3em; margin: 0; color: #9a394e; font-size: .82rem; }
.account-switch { margin: 24px 0 0; color: #75626b; font-size: .86rem; }
.link-button { color: var(--wine); text-decoration: underline; }

.memory-admin-body { min-height: 100vh; }
.memory-admin-page { padding: clamp(52px, 8vw, 96px) 0 100px; }
.memory-admin-intro { max-width: 790px; margin-bottom: 54px; }
.memory-admin-intro h1 { font-size: clamp(3.5rem, 8vw, 7.2rem); }
.memory-admin-intro > p:not(.eyebrow) { max-width: 720px; color: #6c5962; font: 1.08rem/1.7 Georgia, serif; }
.memory-security-note { padding: 15px 18px; background: rgba(239,225,217,.75); border-left: 4px solid var(--rose); border-radius: 4px 14px 14px 4px; }
.memory-workspace { display: grid; grid-template-columns: minmax(340px, .82fr) minmax(0, 1.18fr); gap: clamp(30px, 5vw, 70px); align-items: start; }
.memory-form, .memory-library { padding: clamp(25px, 4vw, 42px); background: rgba(255,255,255,.7); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); }
.memory-form { position: sticky; top: 24px; }
.memory-form h2, .memory-library h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.2rem); }
.memory-form-heading, .memory-library-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.memory-form-heading .eyebrow, .memory-library-heading .eyebrow { margin-bottom: 8px; }
.memory-fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.memory-fields-grid small, .memory-photo-picker span { color: #8a747e; font-size: .67rem; font-weight: 500; letter-spacing: 0; line-height: 1.45; text-transform: none; }
.memory-photo-picker input { padding: 10px; }
.memory-photo-preview { width: min(100%, 420px); max-height: 280px; object-fit: contain; background: #eaded7; border: 1px solid var(--line); border-radius: 16px; }
.memory-options { display: grid; gap: 11px; padding: 18px; background: rgba(239,225,217,.48); border-radius: 16px; }
.memory-check { display: flex; grid-template-columns: none; align-items: center; gap: 10px; letter-spacing: 0; text-transform: none; }
.memory-check input { width: 19px; min-height: 19px; accent-color: var(--wine); }
.memory-form-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.memory-form-actions .form-message { flex: 1; }
.memory-library-heading > span { padding-top: 9px; color: #826c76; font-size: .76rem; font-weight: 750; white-space: nowrap; }
.memory-list { display: grid; gap: 20px; }
.memory-card { overflow: hidden; background: #fffdfa; border: 1px solid var(--line); border-radius: 20px; }
.memory-card-photo { width: 100%; max-height: 380px; display: block; object-fit: contain; background: #e9ddd6; }
.memory-card-body { padding: 24px; }
.memory-card-flags { margin: 0 0 8px; color: var(--wine); font-size: .65rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.memory-card h3 { margin: 0 0 13px; color: var(--wine-dark); font: 500 1.65rem/1.12 Georgia, serif; }
.memory-card-copy { margin: 0; color: #604f58; line-height: 1.65; white-space: pre-wrap; }
.memory-card-details { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 18px; color: #826d77; font-size: .72rem; }
.memory-card-details span { display: inline-block; }
.memory-card-actions { display: flex; align-items: center; gap: 18px; margin-top: 22px; }
.memory-card-actions .button { min-height: 38px; padding-inline: 17px; }
.text-button.danger { color: #9a394e; }
.memory-empty, .memory-access-card { padding: 34px; color: #6c5962; background: rgba(255,255,255,.64); border: 1px dashed rgba(111,54,80,.25); border-radius: 20px; text-align: center; }
.memory-access-card { max-width: 600px; margin-inline: auto; }

.account-dialog { width: min(460px, calc(100% - 32px)); padding: 44px; color: var(--ink); background: var(--paper); border: 1px solid rgba(111,54,80,.2); border-radius: 24px; box-shadow: 0 36px 120px rgba(30,10,20,.36); }
.account-dialog::backdrop { background: rgba(45,25,34,.5); backdrop-filter: blur(6px); }
.dialog-close { position: absolute; right: 15px; top: 12px; width: 36px; height: 36px; color: var(--wine); background: transparent; border: 0; font-size: 1.8rem; cursor: pointer; }

@media (max-width: 820px) {
  .site-header, main, footer { width: min(100% - 28px, 680px); }
  .site-header { min-height: 74px; }
  nav a:first-child { display: none; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding: 70px 0; }
  .home-page {
    background-image: linear-gradient(180deg, rgba(46,24,31,.13), rgba(46,24,31,.23)), url("/assets/askjanie-mobile.png");
    background-attachment: scroll;
  }
  .home-page .hero { min-height: auto; padding-block: 46px 76px; }
  .home-page .hero-copy { padding: 28px; }
  .hero h1 { font-size: clamp(3.2rem, 15vw, 5.5rem); }
  .letter-card { min-height: 330px; padding: 50px 38px; transform: rotate(1deg); }
  .principles { grid-template-columns: 1fr; }
  .principles article + article { border-left: 0; border-top: 1px solid var(--line); }
  .foundation { grid-template-columns: 1fr; margin-block: 72px; border-radius: 22px; }
  .foundation > p { margin-top: 0; }
  .status-line { grid-column: auto; }
  footer { flex-wrap: wrap; padding-block: 28px; gap: 12px 24px; }
  .footer-brand { width: 100%; }
  .story-grid, .account-page { grid-template-columns: 1fr; }
  .auth-choice-grid { grid-template-columns: 1fr; }
  .auth-panel + .auth-panel { border-left: 0; border-top: 1px solid var(--line); }
  .story-page { padding-block: 75px; }
  .story-grid { margin-top: 50px; }
  .account-page { padding-block: 64px; }
  .memory-workspace { grid-template-columns: 1fr; }
  .memory-form { position: static; }
  .memory-fields-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button { transition: none; }
}

/* Full-screen Janie memorial stage. */
.stage-page {
  min-height: 100svh;
  overflow: hidden;
  background-image: url("/assets/askjanie-1080p.png");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.stage-page .stage-header {
  position: fixed;
  z-index: 4;
  top: 0;
  left: 50%;
  width: min(1180px, calc(100% - 48px));
  min-height: 88px;
  transform: translateX(-50%);
  border: 0;
}

.stage-page .j-account-button {
  background: rgba(75,34,54,.82);
  border-color: rgba(255,255,255,.52);
  box-shadow: 0 8px 28px rgba(24,12,18,.28);
  backdrop-filter: blur(12px);
}

.character-stage {
  position: fixed;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.character-stage canvas { width: 100%; height: 100%; display: block; }
.stage-error { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); margin: 0; padding: 9px 14px; color: #fff8f3; background: rgba(58,25,36,.78); border-radius: 999px; font-size: .76rem; backdrop-filter: blur(10px); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.ask-janie {
  position: fixed;
  z-index: 6;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  width: min(680px, calc(100% - 34px));
  transform: translateX(-50%);
  pointer-events: auto;
}

.ask-janie__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  background: rgba(47,23,33,.84);
  border: 1px solid rgba(255,241,229,.52);
  border-radius: 999px;
  box-shadow: 0 14px 48px rgba(20,8,13,.35);
  backdrop-filter: blur(18px);
}
.ask-janie__form input { min-height: 48px; padding-inline: 19px; color: #fffaf6; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.16); border-radius: 999px; }
.ask-janie__form input::placeholder { color: rgba(255,250,246,.68); }
.ask-janie__form input:focus { border-color: rgba(255,241,229,.7); box-shadow: 0 0 0 3px rgba(255,241,229,.1); }
.ask-janie__form button { min-width: 84px; padding: 0 20px; color: var(--wine-dark); background: #fff3e8; border: 0; border-radius: 999px; font-weight: 850; cursor: pointer; }
.ask-janie__form button:disabled { opacity: .62; cursor: wait; }
.ask-janie__status { min-height: 17px; margin: 7px 18px 0; color: #fff8f3; font-size: .68rem; font-weight: 750; text-align: center; text-shadow: 0 2px 8px rgba(0,0,0,.65); }
.janie-answer { width: min(580px, calc(100% - 24px)); display: block; margin: 0 auto 12px; padding: 17px 21px 13px; color: var(--wine-dark); background: rgba(255,248,241,.88); border: 1px solid rgba(255,255,255,.7); border-radius: 22px; box-shadow: 0 13px 42px rgba(20,8,13,.3); font: 1.03rem/1.48 Georgia, "Times New Roman", serif; text-align: left; cursor: pointer; backdrop-filter: blur(18px); }
.janie-answer[hidden] { display: none; }
.janie-answer small { display: block; margin-top: 8px; color: #8b6676; font: 700 .6rem/1.2 Inter, sans-serif; letter-spacing: .08em; text-align: right; text-transform: uppercase; }

.memorial-loader {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff7f0;
  background: radial-gradient(circle at 50% 42%, #713c50 0, #482131 45%, #25131b 100%);
  opacity: 1;
  visibility: visible;
  transition: opacity 1.15s ease, visibility 1.15s step-end;
}

.memorial-loader.is-ready { opacity: 0; visibility: hidden; }
.memorial-loader__copy { width: min(560px, calc(100% - 54px)); text-align: center; }
.memorial-loader__dates { margin: 0 0 23px; color: #e3bdc6; font-size: clamp(.72rem, 1.7vw, .92rem); font-weight: 800; letter-spacing: .2em; }
.memorial-loader h1 { margin: 0; color: #fff8f2; font-size: clamp(2.8rem, 7vw, 5.8rem); font-style: italic; line-height: 1; text-shadow: 0 8px 35px rgba(0,0,0,.22); }
.memorial-loader__status { margin: 30px 0 12px; color: #d9b7bf; font-size: .69rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.memorial-loader__progress { display: block; width: min(240px, 62vw); height: 2px; margin: auto; overflow: hidden; background: rgba(255,255,255,.17); }
.memorial-loader__progress i { display: block; width: 4%; height: 100%; background: #f4d8cd; transition: width .24s ease; }

@media (max-width: 820px) {
  .stage-page { background-image: url("/assets/askjanie-mobile.png"); background-position: center; }
  .stage-page .stage-header { width: calc(100% - 28px); min-height: 74px; }
  .ask-janie { bottom: max(10px, env(safe-area-inset-bottom)); width: calc(100% - 20px); }
  .ask-janie__form { gap: 6px; padding: 6px; }
  .ask-janie__form input { min-height: 46px; padding-inline: 15px; }
  .ask-janie__form button { min-width: 68px; padding-inline: 15px; }
  .janie-answer { max-height: 33vh; overflow: auto; padding: 14px 17px 11px; font-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .memorial-loader { transition-duration: .2s; }
}
