:root {
  --bg: #F7F3ED;
  --bg-alt: #FDFCFA;
  --ink: #1A1714;
  --ink-light: #4A453D;
  --ink-faint: #8A8479;
  --rule: #D4CFC7;
  --accent: #6B4C3B;
  --accent-hover: #1A1714;
  --dot: #6B4C3B;
}
[data-theme="dark"] {
  --bg: #1C1A17;
  --bg-alt: #242220;
  --ink: #E8E3DB;
  --ink-light: #B5AFA5;
  --ink-faint: #7A756D;
  --rule: #3A3632;
  --accent: #C4956E;
  --accent-hover: #E8E3DB;
  --dot: #C4956E;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 18px; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font-family: 'Cormorant Garamond', Georgia, serif; -webkit-font-smoothing: antialiased; transition: background 0.4s ease, color 0.4s ease; }

.theme-toggle { background: none; border: none; cursor: pointer; color: var(--ink-faint); transition: color 0.2s; display: flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem; padding: 0; }
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes contentIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* TOPBAR */
.topbar { display: flex; justify-content: space-between; align-items: center; max-width: 42rem; margin: 0 auto; padding: 2rem 0 1.5rem; border-bottom: 1px solid var(--rule); }
.topbar-brand { font-family: 'Inter', sans-serif; font-size: 0.6rem; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-faint); cursor: pointer; transition: color 0.2s; background: none; border: none; text-decoration: none; display: inline-block; }
.topbar-brand:hover { color: var(--ink); }
.topbar-nav { display: flex; gap: 1.2rem; align-items: center; }
.topbar-date { font-family: 'Inter', sans-serif; font-size: 0.6rem; font-weight: 400; letter-spacing: 0.1em; color: var(--ink-faint); }
.topbar-link { font-family: 'Inter', sans-serif; font-size: 0.6rem; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); cursor: pointer; transition: color 0.2s; background: none; border: none; text-decoration: none; display: inline-block; }
.topbar-link:hover { color: var(--ink); }

/* READER */
.reader { padding: 0 2rem; min-height: 100vh; animation: fadeIn 0.6s ease-out both; }
.human-header { max-width: 42rem; margin: 0 auto; padding: 4rem 0 0; animation: contentIn 0.9s ease-out both 0.1s; }
.human-name { font-size: 4rem; font-weight: 300; line-height: 1.05; letter-spacing: -0.025em; margin-bottom: 1rem; }
.human-tagline { font-size: 1.15rem; font-weight: 400; font-style: italic; color: var(--ink-light); line-height: 1.65; max-width: 38rem; }
.rule { max-width: 42rem; margin: 2.5rem auto; border: none; border-top: 1px solid var(--rule); }
.human-body { max-width: 42rem; margin: 0 auto; padding-bottom: 2rem; animation: contentIn 0.9s ease-out both 0.25s; }
.section-label { font-family: 'Inter', sans-serif; font-size: 0.55rem; font-weight: 500; letter-spacing: 0.28em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 1rem; margin-top: 2.8rem; }
.section-label:first-child { margin-top: 0; }
.human-body p { font-size: 1.15rem; font-weight: 400; line-height: 1.85; margin-bottom: 1rem; }
.linked-name { color: var(--accent); cursor: pointer; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.linked-name:hover { border-bottom-color: var(--accent); }

.references { max-width: 42rem; margin: 0 auto; padding: 2rem 0; border-top: 1px solid var(--rule); }
.ref-label { font-family: 'Inter', sans-serif; font-size: 0.55rem; font-weight: 500; letter-spacing: 0.28em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.8rem; }
.ref-text { font-size: 0.95rem; font-weight: 400; font-style: italic; color: var(--ink-light); line-height: 1.8; }

/* REFLECT */
.input-sm { flex: 1; min-width: 200px; padding: 0.7rem 1rem; font-family: 'Inter', sans-serif; font-size: 0.75rem; color: var(--ink); background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 2px; outline: none; transition: border-color 0.3s; }
.input-sm::placeholder { color: var(--ink-faint); }
.input-sm:focus { border-color: var(--accent); }
.btn-sm { font-family: 'Inter', sans-serif; font-size: 0.6rem; font-weight: 500; letter-spacing: 0.15em; text-transform: uppercase; padding: 0.7rem 1.5rem; cursor: pointer; transition: all 0.3s; white-space: nowrap; border: 1px solid var(--accent); background: var(--accent); color: var(--bg); }
.btn-sm:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm:disabled { opacity: 0.4; cursor: default; }
.confirm-msg { font-family: 'Inter', sans-serif; font-size: 0.7rem; color: var(--accent); margin-top: 0.5rem; opacity: 0; transition: opacity 0.4s; }
.confirm-msg.visible { opacity: 1; }
.error-msg { font-family: 'Inter', sans-serif; font-size: 0.7rem; color: #a0522d; margin-top: 0.5rem; opacity: 0; transition: opacity 0.4s; }
.error-msg.visible { opacity: 1; }

.reflect-section { max-width: 42rem; margin: 0 auto; padding: 3rem 0; border-top: 1px solid var(--rule); }
.reflect-label { font-family: 'Inter', sans-serif; font-size: 0.55rem; font-weight: 500; letter-spacing: 0.28em; text-transform: uppercase; color: var(--accent); margin-bottom: 1.2rem; }
.reflect-question { font-size: 1.35rem; font-weight: 400; font-style: italic; line-height: 1.7; margin-bottom: 2rem; max-width: 36rem; }
.reflect-textarea { width: 100%; min-height: 7rem; padding: 1.2rem; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.05rem; line-height: 1.75; color: var(--ink); background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 2px; resize: vertical; outline: none; transition: border-color 0.3s; }
.reflect-textarea::placeholder { color: var(--ink-faint); font-style: italic; }
.reflect-textarea:focus { border-color: var(--accent); }
.reflect-actions { display: flex; align-items: center; gap: 0.8rem; margin-top: 1rem; flex-wrap: wrap; }

.reflect-share-friend { display: none; margin-top: 1.8rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); animation: contentIn 0.5s ease-out both; }
.reflect-share-friend.visible { display: block; }
.reflect-share-friend-prompt { font-size: 0.95rem; font-style: italic; color: var(--ink-light); margin-bottom: 1rem; }
.reflect-share-friend-row { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }

/* EXPLORE */
.explore { padding: 0 2rem; min-height: 100vh; animation: fadeIn 0.6s ease-out both; }
.explore-header { max-width: 42rem; margin: 0 auto; padding: 4rem 0 2rem; }
.explore-title { font-size: 2.4rem; font-weight: 300; margin-bottom: 0.8rem; }
.explore-desc { font-size: 1rem; font-style: italic; color: var(--ink-light); line-height: 1.7; margin-bottom: 2rem; }
.explore-search { width: 100%; padding: 0.9rem 1.2rem; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.1rem; color: var(--ink); background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 2px; outline: none; transition: border-color 0.3s; }
.explore-search:focus { border-color: var(--accent); }
.explore-list { max-width: 42rem; margin: 0 auto; padding-bottom: 4rem; }
.explore-letter { font-size: 2rem; font-weight: 300; color: var(--ink-faint); padding: 2rem 0 0.5rem; border-bottom: 1px solid var(--rule); margin-bottom: 0.8rem; }
.explore-item { padding: 0.9rem 0; cursor: pointer; transition: padding-left 0.2s; display: flex; align-items: flex-start; gap: 0.7rem; text-decoration: none; color: inherit; }
.explore-item:hover { padding-left: 0.5rem; }
.explore-dot { width: 6px; height: 6px; min-width: 6px; border-radius: 50%; margin-top: 0.55rem; background: transparent; transition: background 0.3s; }
.explore-dot.read { background: var(--dot); }
.explore-item-content { flex: 1; }
.explore-item-name { font-size: 1.2rem; font-weight: 500; margin-bottom: 0.15rem; }
.explore-item-tagline { font-size: 0.85rem; font-style: italic; color: var(--ink-light); line-height: 1.5; }

/* ABOUT */
.about { padding: 0 2rem; min-height: 100vh; animation: fadeIn 0.6s ease-out both; }
.about-content { max-width: 42rem; margin: 0 auto; padding: 4rem 0 2rem; }
.about-content p { font-size: 1.15rem; font-weight: 400; line-height: 1.85; margin-bottom: 1.2rem; }
.about-content .standout { font-size: 1.3rem; margin-top: 0.5rem; margin-bottom: 1.5rem; }
.about-content .closing { font-style: italic; color: var(--ink-light); margin-top: 2rem; }
.about-content .sign { margin-top: 0.3rem; color: var(--ink-light); }

/* MODAL */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(26,23,20,0.55); z-index: 100; align-items: center; justify-content: center; padding: 2rem; }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.6); }
.modal-overlay.active { display: flex; animation: fadeIn 0.3s ease; }
.modal { background: var(--bg); max-width: 28rem; width: 100%; padding: 3rem; position: relative; animation: contentIn 0.4s ease-out; }
.modal-close { position: absolute; top: 1rem; right: 1.2rem; font-size: 1.4rem; background: none; border: none; color: var(--ink-faint); cursor: pointer; line-height: 1; transition: color 0.2s; }
.modal-close:hover { color: var(--ink); }
.modal h2 { font-size: 1.8rem; font-weight: 300; margin-bottom: 0.8rem; }
.modal p { font-size: 0.95rem; font-style: italic; color: var(--ink-light); line-height: 1.7; margin-bottom: 1.8rem; }
.modal-input { width: 100%; padding: 0.85rem 1rem; font-family: 'Inter', sans-serif; font-size: 0.8rem; color: var(--ink); background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 2px; outline: none; margin-bottom: 1rem; transition: border-color 0.3s; }
.modal-input:focus { border-color: var(--accent); }
.modal-submit { width: 100%; font-family: 'Inter', sans-serif; font-size: 0.65rem; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--bg); background: var(--accent); border: none; padding: 0.9rem; cursor: pointer; transition: background 0.3s; }
.modal-submit:hover { background: var(--accent-hover); }
.modal-submit:disabled { opacity: 0.4; cursor: default; }
.modal-note { font-family: 'Inter', sans-serif; font-size: 0.6rem; color: var(--ink-faint); text-align: center; margin-top: 1rem; font-style: normal; line-height: 1.5; }

/* FOOTER */
.footer { max-width: 42rem; margin: 0 auto; padding: 3rem 0; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; }
.footer-left { font-family: 'Inter', sans-serif; font-size: 0.55rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-faint); }
.footer-right { display: flex; gap: 1.5rem; }
.footer-link { font-family: 'Inter', sans-serif; font-size: 0.55rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); cursor: pointer; background: none; border: none; transition: color 0.2s; text-decoration: none; display: inline-block; }
.footer-link:hover { color: var(--ink); }

/* LANDING */
.landing { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; text-align: center; animation: fadeUp 1.2s ease-out both; }
.landing-theme { position: absolute; top: 2rem; right: 2rem; }
.landing-mark { font-size: 0.65rem; font-family: 'Inter', sans-serif; font-weight: 500; letter-spacing: 0.25em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 2.5rem; }
.landing h1 { font-size: 3.6rem; font-weight: 300; line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 1.2rem; }
.landing-sub { font-size: 1.25rem; font-weight: 300; font-style: italic; color: var(--ink-light); max-width: 32rem; line-height: 1.6; margin-bottom: 3rem; }
.landing-enter { font-family: 'Inter', sans-serif; font-size: 0.7rem; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); background: none; border: 1px solid var(--accent); padding: 0.9rem 2.4rem; cursor: pointer; transition: all 0.3s; text-decoration: none; display: inline-block; }
.landing-enter:hover { background: var(--accent); color: var(--bg); }

@media (max-width: 640px) {
  html { font-size: 16px; }
  .landing h1 { font-size: 2.6rem; }
  .human-name { font-size: 2.8rem; }
  .topbar { flex-wrap: wrap; gap: 0.5rem; }
  .topbar-nav { flex-wrap: wrap; gap: 0.8rem; }
  .reflect-actions, .reflect-share-friend-row { flex-direction: column; }
  .input-sm { min-width: 100%; }
  .btn-sm { width: 100%; text-align: center; }
  .footer { flex-direction: column; gap: 1rem; text-align: center; }
  .footer-right { flex-wrap: wrap; justify-content: center; }
  .modal { padding: 2rem; }
}
