/* UNBOUND: a mountain-dawn journal. Forest ink on paper, sunrise as the one warm accent. */
:root {
  --bg: #f6f1e7; --surface: #fcf9f3; --surface-2: #ede5d6; --line: #dcd1bf;
  --fg: #2d302b; --muted: #776d5f; --forest: #2c4436; --sage: #8a9b83; --sunrise: #c4884f;
  --btn-bg: #2c4436; --btn-fg: #f6f1e7; --focus: #c4884f; --err: #a94b33; --ok: #4f6b55;
  --f-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-read: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --f-ui: "Jost", "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17211c; --surface: #1e2a24; --surface-2: #26342d; --line: #3a4a41;
    --fg: #ebe3d5; --muted: #b0a38e; --forest: #cdd8c6; --sage: #9fb197; --sunrise: #dba679;
    --btn-bg: #e7ddc9; --btn-fg: #1f3228; --focus: #dba679; --err: #e08a6f; --ok: #a9c2a6; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17211c; --surface: #1e2a24; --surface-2: #26342d; --line: #3a4a41;
  --fg: #ebe3d5; --muted: #b0a38e; --forest: #cdd8c6; --sage: #9fb197; --sunrise: #dba679;
  --btn-bg: #e7ddc9; --btn-fg: #1f3228; --focus: #dba679; --err: #e08a6f; --ok: #a9c2a6; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-ui); font-size: 16px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
a { color: var(--forest); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* layout */
.wrap { max-width: 660px; margin: 0 auto; padding-block: 18px 120px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 18px; }
.wrap.narrow { max-width: 520px; }
.row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.row.center { justify-content: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

/* type */
.display { font-family: var(--f-display); font-weight: 500; font-size: clamp(30px, 7vw, 40px); line-height: 1.1; color: var(--forest); margin: 0; text-wrap: balance; }
.lede, .intro { font-family: var(--f-read); font-style: italic; color: var(--muted); font-size: 18px; margin: 0; text-wrap: pretty; }
.eyebrow, .label { font-family: var(--f-ui); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin: 0; }
.label { display: block; margin: 14px 0 6px; }
.hint { font-family: var(--f-read); font-style: italic; color: var(--muted); font-size: 16px; margin: 6px 0 10px; }
.fine { font-size: 14px; color: var(--muted); margin: 8px 0 0; text-align: center; }
.sub { font-family: var(--f-display); font-weight: 500; font-size: 25px; color: var(--forest); margin: 0 0 6px; line-height: 1.15; }
.phead { text-align: center; padding-top: 6px; }
.phead h2 { font-family: var(--f-display); font-weight: 500; font-size: 36px; margin: 4px 0 6px; color: var(--forest); line-height: 1.1; }
.empty { text-align: center; color: var(--muted); font-family: var(--f-read); font-style: italic; font-size: 17px; padding: 12px 8px; margin: 0; }
.sig { text-align: center; font-family: var(--f-read); font-style: italic; color: var(--muted); font-size: 16px; margin: 6px 0 0; }

/* controls */
.btn { border: 1px solid transparent; border-radius: 999px; padding: 11px 22px; font-family: var(--f-ui); font-size: 15px; letter-spacing: .02em; cursor: pointer; background: var(--surface-2); color: var(--fg); transition: transform .12s ease, opacity .12s ease; }
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--forest); }
.btn.quiet { background: transparent; color: var(--forest); padding: 8px 4px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--sage); }
.btn.danger { background: var(--err); color: var(--surface); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn:not(:disabled):active { transform: scale(.98); }
.link { background: none; border: 0; padding: 4px 0; color: var(--forest); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--sage); cursor: pointer; font-size: 15px; }
.link.small { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 12px; padding: 13px 15px;
  font-family: var(--f-read); font-size: 18px; line-height: 1.5;
}
textarea { resize: vertical; min-height: 3.2em; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 25%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); margin: 14px 0 4px; }
.check input { margin-top: 3px; accent-color: var(--forest); }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; margin: 6px 0 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 999px; cursor: pointer; font-size: 15px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--forest); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.pill { display: inline-block; font-size: 13px; letter-spacing: .04em; color: var(--forest); background: color-mix(in srgb, var(--sage) 18%, transparent); border-radius: 999px; padding: 6px 14px; margin: 8px 0; }
.flash { margin: 10px 0 0; font-size: 15px; padding: 10px 14px; border-radius: 10px; }
.flash.err { color: var(--err); background: color-mix(in srgb, var(--err) 9%, transparent); }
.flash.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.card.form .btn { margin-top: 14px; }
.card.invite .code { font-family: var(--f-ui); font-size: 22px; letter-spacing: .2em; color: var(--forest); }
.card.keepsake { text-align: center; background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--sunrise) 8%, var(--surface))); }
.card.keepsake p { font-family: var(--f-read); font-size: 17px; margin: 4px 0 10px; }
.danger-zone { border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
ul.plain { margin: 6px 0 10px; padding-left: 18px; font-family: var(--f-read); font-size: 17px; display: grid; gap: 6px; }

/* header + nav */
.preview-bar { text-align: center; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--btn-fg); background: var(--forest); padding: 6px 16px; }
.top { display: flex; justify-content: space-between; align-items: center; max-width: 660px; margin: 0 auto; padding-block: 12px 0; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; padding: 0; }
.brand img { border-radius: 50%; width: 34px; height: 34px; }
.brand span { font-weight: 300; letter-spacing: .38em; font-size: 15px; color: var(--forest); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.icon-btn.on { border-color: var(--sage); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg { color: var(--forest); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.tabs button { flex: 1; max-width: 120px; display: grid; justify-items: center; gap: 2px; background: none; border: 0; padding: 6px 2px; cursor: pointer; color: var(--muted); font-size: 11.5px; letter-spacing: .04em; }
.tabs button.on { color: var(--forest); }
.tabs button.on svg { stroke-width: 1.9; }

/* auth */
.auth { min-height: 100%; display: grid; justify-items: center; padding-bottom: 40px; }
.auth-hero { width: 100%; height: clamp(210px, 38vw, 340px); overflow: hidden; }
.auth-hero img { width: 100%; height: 100%; object-fit: cover; object-position: center 45%; }
.auth-card { width: min(480px, calc(100% - 32px)); margin-top: -30px; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px 22px 22px; box-shadow: 0 12px 40px rgba(30, 40, 30, .12); }
.auth-card .display { font-size: clamp(28px, 7vw, 34px); }
.auth-card .lede { margin: 10px 0 8px; font-size: 17px; }
.auth-card .btn.wide { margin-top: 16px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.or + .btn.wide { margin-top: 12px; }

/* onboarding + boot */
.onboard { text-align: center; padding-top: 40px; }
.onboard .seal { border-radius: 50%; margin: 0 auto; }
.onboard textarea { text-align: left; }
.onboard .row { justify-content: center; }
.boot { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); font-family: var(--f-read); font-style: italic; }
.boot img { border-radius: 50%; animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04); opacity: .85; } }
@media (prefers-reduced-motion: reduce) { .boot img { animation: none; } .btn { transition: none; } }

/* journal page */
.jpage { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px; min-width: 0; }
.jpage .eyebrow { text-align: center; color: var(--sunrise); }
.title { font-family: var(--f-display); font-weight: 500; font-size: 34px; line-height: 1.12; text-align: center; margin: 8px 0 2px; color: var(--forest); text-wrap: balance; }
.title.sm { font-size: 26px; text-align: left; margin-top: 4px; }
.date { text-align: center; font-family: var(--f-read); font-style: italic; color: var(--muted); font-size: 16px; margin: 0; }
.question { font-family: var(--f-display); font-size: 25px; font-weight: 500; line-height: 1.3; text-align: center; margin: 20px auto 14px; max-width: 26em; text-wrap: balance; }
.question.sm { font-size: 21px; text-align: left; margin: 6px 0 12px; }
.turn { margin: 16px 0; }
.turn .words { font-family: var(--f-read); font-size: 19px; line-height: 1.65; border-left: 2px solid var(--sage); padding: 0 0 0 16px; overflow-wrap: anywhere; }
.turn .words p, .turn.companion p { margin: 0 0 .7em; }
.turn.companion { background: color-mix(in srgb, var(--sage) 10%, transparent); border-radius: 14px; padding: 14px 16px; }
.turn.companion p { font-family: var(--f-read); font-style: italic; font-size: 18px; line-height: 1.6; overflow-wrap: anywhere; }
.turn.companion p:last-child { margin-bottom: 0; }
.who { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.thinking p { animation: breathe 2.4s ease-in-out infinite; }
.composer { display: grid; gap: 12px; margin-top: 16px; }
.page-close { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.page-close.edit .btn { margin-top: 14px; }
.closing { display: grid; gap: 12px; margin-top: 8px; }
blockquote { margin: 10px 0; font-family: var(--f-display); font-style: italic; font-size: 24px; line-height: 1.35; text-align: center; color: var(--forest); text-wrap: balance; }
.cl p { margin: 2px 0 0; font-family: var(--f-read); font-size: 18px; line-height: 1.55; }
.cl .label { margin: 0; }
.bookpage .title { font-size: 30px; }

/* thread */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 22px 22px; border-left: 1px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--sunrise); }
.timeline .when { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.timeline .v { font-family: var(--f-read); font-size: 18px; line-height: 1.6; overflow-wrap: anywhere; }
.timeline .v p { margin: 4px 0; }
.meta { font-family: var(--f-read); font-size: 16px; margin: 4px 0; color: var(--fg); }
.meta .label { display: inline; margin: 0 6px 0 0; }

/* circles */
.list { display: grid; gap: 10px; }
.listbtn { display: grid; gap: 2px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; cursor: pointer; }
.listbtn .t { font-family: var(--f-display); font-size: 23px; font-weight: 500; color: var(--forest); }
.listbtn .m { font-size: 13px; color: var(--muted); }
.answer { border-left: 2px solid var(--sage); padding: 2px 0 2px 14px; margin: 12px 0; font-family: var(--f-read); font-size: 18px; overflow-wrap: anywhere; }
.answer p { margin: 0 0 .5em; }
.card > .btn { margin-top: 12px; }
.notes { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 12px; }
.notes li { border-top: 1px solid var(--line); padding-top: 12px; font-family: var(--f-read); font-size: 18px; overflow-wrap: anywhere; }
.notes p { margin: 0 0 4px; }
.notes .when { font-size: 12px; color: var(--muted); font-family: var(--f-ui); margin-right: 10px; }
details.past { border-top: 1px solid var(--line); padding: 10px 0; }
details.past summary { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; color: var(--forest); font-family: var(--f-display); font-size: 19px; }
details.past summary .when { font-family: var(--f-ui); font-size: 12px; color: var(--muted); }

@media (min-width: 720px) {
  .jpage { padding: 36px 44px; }
  .wrap { padding-top: 26px; }
}
@media print {
  .tabs, .top, .preview-bar, .btn, .card.keepsake, .link, .flash { display: none !important; }
  body { background: #fff; color: #000; }
  .jpage { border: 0; break-inside: avoid; page-break-after: always; }
  details.past { display: block; }
  details.past > * { display: block; }
}

/* Likes and comments on circle posts */
.social { margin-top: 8px; font-family: var(--f-ui); }
.social-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.react { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; min-height: 32px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.react:hover { border-color: var(--sage); color: var(--forest); }
.react.on { color: var(--forest); border-color: var(--sage); }
.liked-by { font-size: 12px; color: var(--muted); }
.comments { margin-top: 10px; padding-left: 12px; border-left: 1px solid var(--line); display: grid; gap: 10px; }
.comment { font-family: var(--f-read); font-size: 16px; overflow-wrap: anywhere; }
.comment p { margin: 0 0 4px; }
.comment-new textarea { font-size: 16px; }
@media print { .social { display: none !important; } }

/* Intro tour + onboarding steps: centered on any screen */
.onboard.tour, .onboard.step { min-height: 100vh; min-height: 100dvh; box-sizing: border-box; align-content: center; justify-items: center; padding-top: max(32px, env(safe-area-inset-top, 0px)); padding-bottom: max(40px, env(safe-area-inset-bottom, 0px)); width: 100%; }
.onboard.step > * { width: 100%; }
.onboard.step > .seal { width: 96px; }
.tour .display { font-size: clamp(32px, 6.5vw, 52px); }
.tour .tour-body { font-family: var(--f-read); font-style: italic; font-size: clamp(19px, 2.6vw, 24px); line-height: 1.5; color: var(--fg); margin: 4px auto 0; max-width: 32ch; text-wrap: pretty; }
.tour .seal { width: clamp(84px, 12vw, 120px); height: auto; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 18px 0 4px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots span.on { background: var(--forest); }
.tour .row { justify-content: center; }
@media (min-width: 720px) { .wrap.narrow.tour, .wrap.narrow.step { max-width: 600px; } }
.tour .tour-tagline { font-family: var(--f-ui); font-size: clamp(13px, 1.6vw, 15px); letter-spacing: .12em; text-transform: uppercase; color: var(--forest); margin: 6px 0 -4px; font-weight: 500; }
/* What comes naturally */
.natural { display: grid; gap: 14px; text-align: left; }
.nq { border: 0; margin: 0; padding: 0; }
.nq legend { font-family: var(--f-read); font-size: 18px; color: var(--fg); padding: 0; margin-bottom: 6px; }
.pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; }
.pick button { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 12px; min-height: 44px; cursor: pointer; font-size: 14px; color: var(--muted); line-height: 1.3; }
.pick button:nth-child(2) { font-size: 13px; padding-inline: 10px; }
.pick button.on { border-color: var(--forest); background: var(--forest); color: #fff; }
@media (max-width: 480px) { .pick { grid-template-columns: 1fr 1fr; } .pick button:nth-child(2) { grid-column: 1 / -1; order: 3; } }
.bday input { max-width: 240px; margin: 0 auto; display: block; text-align: center; }
.card .bday input { margin: 0; text-align: left; }
/* Daily nudges + Home Screen helper */
.nd-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nd-row input[type="time"] { width: auto; min-width: 140px; }
.toggle { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 8px 16px; min-height: 40px; min-width: 110px; cursor: pointer; font-size: 15px; }
.toggle.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.steps { margin: 6px 0 8px; padding-left: 22px; display: grid; gap: 8px; font-size: 16px; }
.ios-share { width: 20px; height: 20px; vertical-align: -4px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: #0a7aff; }
.card.tip p { margin: 0 0 8px; font-size: 16px; }

/* Practice: privacy note + share with circle */
.private-note { font-size: 15px; margin-top: 10px; }
.share-circle { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.share-circle.open { background: var(--surface-2); border: 0; border-radius: 16px; padding: 16px; }
.share-circle select, .share-circle textarea { width: 100%; }

/* Circle: locked until someone joins, then a one-time "it's open" welcome */
.card.locked { border-style: dashed; }
.card.locked .eyebrow::before { content: "🔒 "; letter-spacing: 0; }
.unlocks { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 12px; }
.unlocks li { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); opacity: .8; }
.unlocks b { font-weight: 500; color: var(--forest); }
.unlocks span { font-family: var(--f-read); font-style: italic; color: var(--muted); font-size: 16px; }
.card.unlocked { border-color: var(--sunrise); background: linear-gradient(180deg, color-mix(in srgb, var(--sunrise) 14%, var(--surface)), var(--surface)); text-align: center; }
.card.unlocked .eyebrow { color: var(--sunrise); }
.card.unlocked .eyebrow::before { content: "✦ "; }
.seg button { white-space: nowrap; }
/* Pick-any-that-fit chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; font-size: 14px; color: var(--muted); line-height: 1.3; }
.chip.on { border-color: var(--forest); background: var(--forest); color: var(--surface); }
.hint-inline { font-family: var(--f-read); font-style: italic; color: var(--muted); font-size: 15px; margin-left: 4px; }
.onboard .natural { margin-top: 8px; }
.onboard .chips { justify-content: center; }
.onboard .nq legend { width: 100%; text-align: center; }
