/* ==========================================================
   JOURNA :: THE PAGE
   One experience that happens to fit in your hand (prompt 12): mobile first, then more breathing room. Components size themselves
   with container queries (prompt 31), not the viewport.
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  min-height: 100vh;
}
img, svg, video { max-width: 100%; }
a { color: var(--adventurer); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
h2 { font-size: 1.35rem; }
/* Headings in the display face (IM Fell English, the nautical touches of 2026-11-24). It has one weight, so no faked bold; it sets a
   little small, so it is made a touch larger. */
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: 0; font-synthesis: none; }
h1 { font-size: clamp(1.85rem, 5.4vw, 2.6rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .9rem; }
.lead { font-size: 1.15rem; color: var(--ink-soft); }
.quiet { color: var(--ink-soft); }
/* "Open in Legacy": a quiet line at the top of a page Legacy draws too, for someone who has Legacy on Windows. */
.legacy-open { margin: 0 0 .5rem; text-align: right; font: .85rem var(--sans); }
.legacy-open a { color: var(--navigator); }
.faint { color: var(--ink-faint); font-size: .92rem; }
.small { font-size: .9rem; }
.lines { white-space: pre-line; }
.center { text-align: center; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: 8px; }

/* Every interactive element should feel like a lighthouse beacon (prompt 32). */
:focus-visible {
  outline: 3px solid var(--horizon-calling);
  outline-offset: 4px;
  box-shadow: 0 0 0 8px rgba(213, 170, 82, .20);
  border-radius: 6px;
}

/* ----- The frame ----- */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: .45rem var(--gutter) .6rem;
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; gap: .5rem; max-width: 1100px; margin: 0 auto; min-height: 44px; }
.brand { font-family: var(--display); font-weight: 400; font-synthesis: none; font-size: 1.45rem; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.top .spacer { flex: 1; }

/* Explore and Build (the owner's "Journa Home Page Redesign", 2026-11-23; Participate was removed by "Eliminate Participate",
   2026-11-24): two buttons under the name, each opening its list beneath the header. Mobile first, and the same at every width: no
   desktop-style navigation. */
.activities { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; max-width: 24rem; margin: .35rem auto 0; }
.activity > summary {
  list-style: none; display: flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px; padding: .35rem .5rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: 600 .98rem var(--sans); cursor: pointer; user-select: none;
}
.activity > summary::-webkit-details-marker { display: none; }
.activity > summary:hover { background: var(--surface-2); }
.activity[data-here="true"] > summary { border-color: var(--navigator); box-shadow: inset 0 -3px 0 var(--navigator-3); }
.activity[open] > summary { background: var(--surface-2); border-color: var(--ink-soft); }
.activity-caret { width: .75rem; height: .75rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.activity[open] .activity-caret { transform: rotate(180deg); }
/* Each menu is a small list of names right under its own word, like a tooltip (2026-11-24: "too much to read"): Explore's opens to
   the right of its word, Build's to the left, so neither leaves a phone's screen. */
.activity { position: relative; }
.activity-panel {
  position: absolute; top: calc(100% + .45rem); z-index: 30; left: 50%; transform: translateX(-50%);
  width: max-content; min-width: 12.5rem; max-width: min(21rem, calc(100vw - 2 * var(--gutter)));
  display: grid; gap: 0; padding: .4rem; max-height: calc(100vh - 9rem); overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.activity[data-activity="explore"] .activity-panel { left: 0; transform: none; }
.activity[data-activity="build"] .activity-panel { left: auto; right: 0; transform: none; }
.activity-link { display: block; padding: .5rem .7rem; border-radius: 10px; color: var(--ink); text-decoration: none; font: 600 1rem var(--serif); white-space: nowrap; }
.activity-link:hover, .activity-link:focus-visible { background: var(--surface-2); }
.activity-worlds, .activity-tools { list-style: none; margin: .1rem .7rem .4rem; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.activity-worlds a, .activity-tools a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: 999px;
  font: .92rem var(--sans); color: var(--ink-soft); text-decoration: none;
}
.activity-worlds a:hover, .activity-tools a:hover { background: var(--surface-2); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .activity-caret { transition: none; } }
/* The header is taller with the three activities: a jump to a heading or section clears it. */
section[id], h2[id], h3[id] { scroll-margin-top: 8.5rem; }
.icon-link {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-width: 44px; min-height: 44px; padding: 0 .6rem;
  border-radius: 999px; color: var(--ink-soft); text-decoration: none; font-family: var(--sans); font-size: .95rem;
  background: transparent; border: 1px solid transparent; cursor: pointer;
}
.icon-link:hover { background: var(--surface-2); color: var(--ink); }
.icon-link svg { width: 20px; height: 20px; }

main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.25rem var(--gutter) calc(var(--bar-h) + 2rem); }
main.wide { max-width: 1400px; }

/* The bar of the page's activity (Pages/Shared/_ActivityBar.cshtml): Build's five, Explore's five. On a wide
   screen the links stay within 44rem in the middle instead of spreading across it. */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding-inline: max(0px, calc((100vw - 44rem) / 2));
  height: var(--bar-h);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-soft); text-decoration: none; font-family: var(--sans); font-size: .78rem;
}
.bottom a svg { width: 22px; height: 22px; }
.bottom a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.bottom a[aria-current="page"] svg { color: var(--navigator); }

/* ----- Words on the page ----- */
.page-head { margin: .5rem 0 1.5rem; }
.page-head p { color: var(--ink-soft); max-width: 46rem; }
.kicker { font-family: var(--sans); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: .25rem; }
.section { margin: 2rem 0; }
.section > h2 { display: flex; align-items: baseline; gap: .6rem; }
.section > h2 .faint { font-weight: 400; }

.flash { padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line-strong); margin-bottom: 1rem; }
.flash.problem { border-color: #C98A6A; }
.closing { font-size: 1.05rem; padding: 1.2rem 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* ----- Controls: invitations, not CTAs (prompt 30) ----- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .7rem 1.2rem;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font: 600 1rem var(--serif); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--horizon-card-focus-bg); border-color: var(--horizon-card-focus-border); }
.btn.primary:hover { box-shadow: var(--horizon-card-shadow-focus); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-soft); font-weight: 400; }
.btn.small { min-height: 36px; padding: .35rem .9rem; font-size: .92rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: .75rem; }

form.card-form, .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow);
}
label { display: block; font-family: var(--sans); font-size: .9rem; color: var(--ink-soft); margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: .75rem .9rem; font: 1rem var(--serif); color: var(--ink);
  background: var(--page); border: 1px solid var(--line-strong); border-radius: 12px;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--horizon-calling); outline-offset: 1px; }
.field { margin-bottom: 1rem; }
.field-row { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.check { display: flex; gap: .5rem; align-items: flex-start; font-family: var(--serif); color: var(--ink); font-size: 1rem; }
.check input { margin-top: .35rem; width: 1.1rem; height: 1.1rem; }
.problem-text { color: #A2471F; font-family: var(--sans); font-size: .9rem; }
@media (prefers-color-scheme: dark) { .problem-text { color: #F0A585; } }

/* ----- Threads (prompt 29: state and temperature are two different things) ----- */
.thread-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .8rem; border-radius: 999px;
  background: rgba(213, 170, 82, .10); color: var(--ink);
  border: 1px solid var(--line-strong); text-decoration: none; font-size: .95rem;
}
.thread-pill:hover { background: rgba(213, 170, 82, .2); }
.thread-pill .strand { width: 18px; height: 6px; border-radius: 3px; background: var(--legacy-2); }
.thread-pill[data-temp="cold"] .strand { background: var(--temp-cold-primary); }
.thread-pill[data-temp="cool"] .strand { background: var(--temp-cool-primary); }
.thread-pill[data-temp="warm"] .strand { background: var(--temp-warm-primary); }
.thread-pill[data-temp="hot"] .strand { background: var(--temp-hot-primary); }
.thread-pill[data-temp="white-hot"] .strand { background: linear-gradient(90deg, var(--temp-whitehot-primary), var(--temp-hot-primary)); }
.pills { display: flex; flex-wrap: wrap; gap: .45rem; padding: 0; margin: 0; list-style: none; }

.thread-card {
  container-type: inline-size;
  position: relative; display: block;
  background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--legacy-3);
  border-radius: var(--radius-sm); padding: 1rem 1.1rem; color: var(--ink); text-decoration: none;
}
.thread-card:hover { box-shadow: var(--shadow); }
.thread-card h3 { margin: 0 0 .2rem; }
.thread-card .words { color: var(--ink-soft); font-size: .95rem; margin: 0; }
.thread-card[data-state="seed"] { opacity: var(--state-seed-opacity); border-left-style: dashed; }
.thread-card[data-state="emerging"] { background: var(--state-emerging-bg); }
.thread-card[data-state="calling"] { background: var(--state-calling-bg); }
.thread-card[data-state="pulled"] { background: var(--state-pulled-bg); }
.thread-card[data-state="active"] { background: var(--state-active-bg); border-left-color: var(--pilot-2); }
.thread-card[data-state="intertwined"] { background: var(--state-intertwined-bg); border-left-color: var(--legacy-2); }
.thread-card[data-state="legacy"] { background: var(--state-legacy-bg); border-left-color: var(--legacy); }
.thread-card[data-state="dormant"] { opacity: var(--state-dormant-opacity); border-left-style: dotted; }
.thread-card[data-state="rediscovered"] { background: var(--state-rediscovered-bg); border-left-color: var(--horizon-calling); }
.thread-card[data-temp="warm"] { box-shadow: var(--temp-warm-shadow); }
.thread-card[data-temp="hot"] { box-shadow: var(--temp-hot-shadow); }
.thread-card[data-temp="white-hot"] { box-shadow: var(--temp-whitehot-shadow); }
.thread-card:focus-visible { outline: none; border-color: var(--horizon-thread-calling-stroke); box-shadow: 0 0 0 4px rgba(213,170,82,.20), var(--temp-warm-shadow); transform: translateY(-2px); }
.cards { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }

.badge { display: inline-block; font-family: var(--sans); font-size: .78rem; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.badge.cold, .badge.cool { background: var(--badge-cold-bg); color: var(--badge-cold-text); }
.badge.warm { background: var(--badge-warm-bg); color: var(--badge-warm-text); }
.badge.hot, .badge.white-hot { background: var(--badge-hot-bg); color: var(--badge-hot-text); }
.state-seed { color: #6F95A6; } .state-emerging { color: #4C7487; } .state-calling { color: var(--navigator-ink); }
.state-pulled, .state-rediscovered { color: #A9602D; } .state-active { color: var(--pilot); }
.state-intertwined { color: var(--legacy); } .state-legacy { color: var(--legacy-2); } .state-dormant { color: var(--ink-faint); }

/* The reflection: a journal note tucked into a logbook (prompts 24, 30). */
.reflection {
  background: var(--reflection-bg); border: 1px solid var(--reflection-border); border-radius: 16px;
  padding: .9rem 1rem; font-style: italic; color: var(--reflection-text); margin: 0;
}

/* ----- What Journa noticed ----- */
.noticed { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: .9rem 1rem; background: var(--surface); }
.noticed + .noticed { margin-top: .6rem; }
.noticed .evidence { color: var(--ink-soft); font-size: .95rem; margin: .2rem 0 .6rem; }

/* ----- Lists of things gathered ----- */
.log { list-style: none; padding: 0; margin: 0; }
.log > li { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.log > li:last-child { border-bottom: 0; }
.log .meta { font-family: var(--sans); font-size: .82rem; color: var(--ink-faint); }
.artifact-photo { display: block; max-height: 260px; border-radius: 12px; margin: .4rem 0; }
.empty { padding: 1.5rem; text-align: center; color: var(--ink-soft); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* Tabs (Adventurer, Navigator, Pilot) */
.modes { display: flex; gap: .4rem; margin: 1rem 0; padding: .3rem; background: var(--surface-2); border-radius: 999px; width: fit-content; max-width: 100%; overflow-x: auto; }
.modes a { padding: .5rem 1rem; border-radius: 999px; text-decoration: none; color: var(--ink-soft); font-family: var(--sans); font-size: .95rem; white-space: nowrap; }
.modes a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.modes a[data-mode="adventurer"][aria-current="page"] { color: var(--adventurer); }
.modes a[data-mode="navigator"][aria-current="page"] { color: var(--navigator-ink); }
.modes a[data-mode="pilot"][aria-current="page"] { color: var(--pilot); }

.two-col { display: grid; gap: 1.5rem; }
@media (min-width: 960px) { .two-col { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }

details.fold > summary { cursor: pointer; font-family: var(--sans); color: var(--ink-soft); padding: .4rem 0; }

/* The search dialog (/) */
dialog.search { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: min(92vw, 36rem); padding: 1.2rem; }
dialog::backdrop { background: rgba(8, 24, 36, .45); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* The personal menu in the top bar */
.me-menu { position: relative; }
.me-menu > summary { list-style: none; }
.me-menu > summary::-webkit-details-marker { display: none; }
.me-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 14rem; z-index: 30;
  display: flex; flex-direction: column; padding: .6rem;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.me-panel a, .link-button {
  display: block; padding: .55rem .7rem; border-radius: 10px; color: var(--ink); text-decoration: none;
  font: 1rem var(--serif); text-align: left; background: none; border: 0; width: 100%; cursor: pointer;
}
.me-panel a:hover, .link-button:hover { background: var(--surface-2); }
.me-panel .faint { padding: .2rem .7rem .4rem; margin: 0; }
.link-button.inline { display: inline; padding: 0; width: auto; color: var(--adventurer); text-decoration: underline; text-underline-offset: 3px; }

/* On a phone the three lenses keep their names and drop the small words, so all three fit. */
@media (max-width: 30rem) {
  .modes a .faint { display: none; }
  .modes a { padding: .5rem .8rem; }
}
/* A thread's Worlds (the thread page): seven ticks. */
.world-ticks { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .35rem 1rem; }
.world-ticks .check { align-items: baseline; flex-wrap: wrap; column-gap: .4rem; }

/* ----- Lanterns (Domain/Lanterns.cs): lit by someone who wants a story to go on. Counts of people in public; never an amount. ----- */
.lantern-count { font-family: var(--sans); font-size: .9rem; letter-spacing: .02em; color: var(--navigator-ink); margin: .1rem 0 .5rem; }
.thread-head .lantern-count { margin-top: .4rem; }
.lantern-since { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--navigator-2); border-radius: var(--radius-sm);
  padding: .6rem .9rem; margin: .4rem 0 .8rem; }
.lantern-since p { margin: 0 0 .25rem; }
.lantern-since ul { margin: .1rem 0 0; padding-left: 1.1rem; }
.lantern-who-title, .lantern-ask-title { font-size: 1rem; margin: 1rem 0 .4rem; }
.lantern-who { list-style: none; padding: 0; margin: 0; }
.lantern-who li { padding: .35rem 0; border-top: 1px solid var(--line); }
.lantern-who li:first-child { border-top: none; }
.lantern-who .who { font-weight: 600; }
.lantern-who .note { display: block; font-style: italic; color: var(--reflection-text); }
.lantern-form { max-width: 28rem; }
.lantern-form .lantern-held { margin: 0; }
.lantern-details { margin: .3rem 0 .2rem; }
.lantern-details > summary { cursor: pointer; font-family: var(--sans); font-size: .85rem; color: var(--ink-soft); }
.lantern-details[open] > summary { margin-bottom: .4rem; }
