/* The Travel Journals — reader site.
   Design locked to the "Journals on the A16" mockup (8/30). Light-only by
   doctrine: the paper stays light, the ground stays grey. */

:root {
  --ground: #eceef1;
  --bar: #ffffff;
  --bar-ink: #23364a;
  --accent: #2b5c8a;
  --muted: #6b7280;
  --rule: #adc4da;
  --margin-line: #d98b7f;
  --ink: #2b3a5c;
  --shadow: rgba(40, 45, 60, .18);
}

/* paper palettes — light-only, ink always black-adjacent */
.paper-cream { --paper: #f6f1e3; --paper-edge: #e6dfc9; }
.paper-white { --paper: #f9f8f4; --paper-edge: #e8e6de; }
.paper-blue  { --paper: #e6edf7; --paper-edge: #cfdcec; }

/* handwriting faces — 3 print, 3 script. Line-height stays LOCKED to the
   ruled lines (7.4cqw); only family + size vary per face. */
.face-homemade-apple { --hand-font: "Homemade Apple", cursive; --hand-size: 4.05cqw; }
.face-patrick-hand   { --hand-font: "Patrick Hand", cursive;   --hand-size: 5.3cqw; }
.face-caveat         { --hand-font: "Caveat", cursive;         --hand-size: 5.6cqw; }
.face-cedarville-cursive   { --hand-font: "Cedarville Cursive", cursive;   --hand-size: 4.8cqw; }
.face-nothing-you-could-do { --hand-font: "Nothing You Could Do", cursive; --hand-size: 4.6cqw; }
.face-la-belle-aurore      { --hand-font: "La Belle Aurore", cursive;      --hand-size: 5.0cqw; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--bar-ink);
  font-family: Roboto, system-ui, sans-serif;
  min-height: 100vh;
}

/* ---------------- header: the site's only chrome ---------------- */
.site-header {
  background: var(--bar);
  box-shadow: 0 1px 3px rgba(30, 40, 60, .12);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  padding: 13px 16px;
  position: sticky; top: 0; z-index: 20;
}
/* Entry pages: Journal / Entry / Location under the wordmark (same labels as
   the byline block), one quiet line that stays put while the paper scrolls. */
.bar-context {
  flex-basis: 100%;
  display: flex; flex-wrap: wrap; gap: 4px 18px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(35, 54, 74, .12);
  font-size: 11px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.bar-context > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bar-context .byl { opacity: .6; }
.bar-context a { color: inherit; text-decoration: none; }
.bar-context a:hover { color: var(--accent); }
@media (max-width: 600px) {
  .bar-context { gap: 2px 14px; font-size: 10.5px; letter-spacing: .08em; }
}
.wordmark {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600; font-size: 19px;
  color: var(--bar-ink);
  letter-spacing: .01em;
  text-decoration: none;
}
.wordmark span { color: var(--accent); }

.explore { position: relative; }
.explore summary {
  list-style: none;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--bar-ink);
  border: 1px solid rgba(35, 54, 74, .25);
  border-radius: 18px; padding: 6px 12px;
  cursor: pointer; user-select: none;
}
.explore summary::-webkit-details-marker { display: none; }
.explore-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bar);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(30, 40, 60, .18);
  padding: 14px 18px;
  min-width: 220px;
  z-index: 30;
}
.explore-menu h4 {
  margin: 10px 0 4px;
  font-size: 11px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.explore-menu h4:first-child { margin-top: 0; }
.explore-menu a {
  display: block;
  color: var(--bar-ink); text-decoration: none;
  font-size: 14px; padding: 4px 0;
}
.explore-menu a:hover { color: var(--accent); }

/* ---------------- layout: paper column + author rail ---------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 700px);
  justify-content: center;
  gap: 40px;
  padding: 20px 14px 26px;
}
.rail { display: none; }
@media (min-width: 1100px) {
  /* Two columns ONLY when a rail is actually rendered — shelf/hub/search
     pages are single-column, or the phantom rail column shoves the content
     left of center. */
  .layout:not(.layout-single) { grid-template-columns: minmax(0, 700px) 280px; }
  .rail { display: block; }
  .rail-inner { position: sticky; top: 78px; }
}

/* Labeled block (Jay 8/31): Author / Journal: / Entry: / Location:. */
.byline {
  font-size: 11.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin: 2px 0 14px;
}
.byline p { margin: 0 0 2px; }
/* Author line reads like the footer wordmark: serif, title case, no tracking. */
.byline .byline-author {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 17px; font-weight: 600;
  letter-spacing: 0; text-transform: none;
  margin-bottom: 6px;
}
.byline .byl { opacity: .6; }
.byline b { color: var(--accent); font-weight: 500; }
.byline a { color: inherit; text-decoration: none; }

/* ---------------- paper ---------------- */
.page {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--paper);
  border-radius: 4px 10px 10px 4px;
  box-shadow: 0 1px 2px var(--shadow), 0 12px 30px -8px var(--shadow),
    inset 0 0 60px rgba(140, 120, 70, .08);
  container-type: inline-size;
}
.page:nth-child(odd)  { transform: rotate(-.35deg); }
.page:nth-child(even) { transform: rotate(.3deg); }
.page + .page { margin-top: 14px; }
.page::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, transparent 0 11%, var(--margin-line) 11%, var(--margin-line) calc(11% + 1px), transparent calc(11% + 1px)),
    repeating-linear-gradient(transparent 0, transparent calc(7.4cqw - 1px),
      var(--rule) calc(7.4cqw - 1px), var(--rule) 7.4cqw);
  background-position: 0 0, 0 8cqw;
  opacity: .5; pointer-events: none;
}
.page::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 2%;
  width: 2.6cqw;
  background: radial-gradient(circle at 50% 50%, var(--paper-edge) 0 34%, rgba(120, 105, 70, .35) 40%, transparent 52%);
  background-size: 100% 8cqw; background-repeat: repeat-y;
  pointer-events: none;
}

.hand {
  position: relative;
  padding: 4.6cqw 6% 6cqw 14%;
  font-family: var(--hand-font, "Homemade Apple", cursive);
  font-size: var(--hand-size, 4.05cqw);
  line-height: 7.4cqw;
  color: var(--ink);
  white-space: pre-line;
  min-height: 100%;
}
.hand .date { font-size: 3.4cqw; opacity: .85; }
.hand .entry-title { text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .14em; }

.coffee {
  position: absolute; right: 9%; top: 7%;
  width: 15cqw; height: 15cqw; border-radius: 50%;
  border: 1cqw solid rgba(150, 100, 45, .16);
  filter: blur(.5px); transform: rotate(8deg) scaleX(1.06);
  pointer-events: none;
}

/* polaroids float inside the text flow — text wraps, never underlaps */
.polaroid {
  width: 36cqw;
  background: #fdfdfa;
  padding: 2cqw 2cqw 1.6cqw;
  box-shadow: 0 2px 5px rgba(30, 30, 40, .25), 0 10px 18px -6px rgba(30, 30, 40, .3);
  border: 0; cursor: zoom-in;
  font-family: var(--hand-font, "Homemade Apple", cursive);
  position: relative;
  transition: transform .18s ease;
  display: block;
}
.polaroid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.polaroid .cap {
  /* In flow, not absolute: a wrapped two-line caption GROWS the white strip
     instead of climbing onto the photo (the launch captions all wrap).
     min-height keeps captionless polaroids' proportions; the extra height
     stays well inside layout.js's 8-line float budget. */
  display: block; min-height: 3.2cqw; margin-top: 1.4cqw;
  text-align: center; font-size: 2.6cqw; line-height: 1.25; color: #4a4a55;
}
.polaroid::before {
  content: ""; position: absolute; top: -2.2cqw; left: 50%;
  width: 13cqw; height: 4cqw;
  transform: translateX(-50%) rotate(-2deg);
  background: rgba(230, 224, 190, .65);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
/* The little "picked up off the page" move: on mice it fires on hover
   (straighten + settle); touch screens have no hover, so taps keep the
   same move via :active. */
@media (hover: hover) {
  .polaroid:hover { transform: scale(.97); }
}
.polaroid:active { transform: scale(.97); }
.float-right { float: right; margin: 1cqw 0 2.5cqw 3.5cqw; transform: rotate(2.5deg); }
.float-left  { float: left;  margin: 1cqw 3.5cqw 2.5cqw 0; transform: rotate(-2.5deg); }

/* closing page for leftover photos — pasted at the TOP of the page, the way
   a person finishes a spread; vertical centering read as a rendering bug. */
.photos-only { display: flex; align-items: flex-start; justify-content: center; gap: 5cqw; flex-wrap: wrap; padding: 8cqw 6%; min-height: 100%; }
.photos-only .polaroid { float: none; }
.photos-only .polaroid:nth-child(odd)  { transform: rotate(-2deg); }
.photos-only .polaroid:nth-child(even) { transform: rotate(2.5deg); }

.pagecount {
  text-align: center; font-size: 11px; color: var(--muted);
  margin: 10px 0 22px;
}

/* ---------------- flip row + author endzone ---------------- */
.endzone {
  display: flex; align-items: stretch; gap: 10px;
  margin: 4px 0 0;
}
.flip-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--bar); color: var(--bar-ink);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  border-radius: 22px; padding: 12px 10px;
  box-shadow: 0 1px 3px var(--shadow);
  text-align: center;
}
.flip-btn .dir { color: var(--accent); font-size: 15px; }
.flip-btn small { color: var(--muted); font-weight: 400; }

/* ---------------- author card ---------------- */
.author-card {
  background: var(--bar);
  border-radius: 14px;
  box-shadow: 0 1px 3px var(--shadow);
  padding: 18px;
  text-align: center;
}
.avatar, .avatar-letter {
  width: 72px; height: 72px; border-radius: 50%;
  margin: 0 auto 10px;
  display: block; object-fit: cover;
}
/* Click target = exactly the avatar circle, nothing wider */
.avatar-link {
  display: block; width: 72px; margin: 0 auto 10px;
  border-radius: 50%;
}
.avatar-link .avatar, .avatar-link .avatar-letter { margin: 0; }
.avatar-letter {
  background: #dfe4ea; color: var(--bar-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 30px; font-weight: 600;
}
.author-name {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 16px; font-weight: 600;
  color: var(--bar-ink);
  margin: 0 0 6px;
}
.author-name a { color: inherit; text-decoration: none; }
.author-blurb {
  font-size: 13px; line-height: 1.55; color: var(--muted);
  margin: 0 0 12px;
}
.author-links { display: flex; justify-content: center; gap: 14px; }
.author-links a, .bookmark-btn {
  color: var(--muted);
  display: inline-flex;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.author-links a:hover, .bookmark-btn:hover { color: var(--bar-ink); }
.bookmark-hint {
  display: none;
  font-size: 11px; color: var(--muted); margin-top: 8px;
}
.bookmark-hint.show { display: block; }

/* compact variant between the flip buttons on small screens */
.author-mini {
  flex: 1.4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  background: var(--bar);
  border-radius: 22px; padding: 8px 10px;
  box-shadow: 0 1px 3px var(--shadow);
  text-decoration: none;
}
.author-mini .avatar, .author-mini .avatar-letter {
  width: 34px; height: 34px; margin: 0; font-size: 15px;
}
.author-mini .author-name { font-size: 12px; margin: 0; }
@media (min-width: 1100px) { .author-mini { display: none; } }

/* ---------------- author search ---------------- */
.explore-search { display: flex; gap: 6px; margin-top: 4px; }
.explore-search input, .authors-search input {
  flex: 1;
  border: 1px solid rgba(35, 54, 74, .25);
  border-radius: 16px;
  padding: 7px 12px;
  font: inherit; font-size: 13.5px;
  color: var(--bar-ink);
  background: var(--bar);
  min-width: 0;
}
.explore-search button, .authors-search button {
  border: 1px solid rgba(35, 54, 74, .25);
  border-radius: 16px;
  background: var(--bar);
  color: var(--accent);
  font: inherit; font-size: 14px;
  padding: 7px 14px;
  cursor: pointer;
}
.authors-search { display: flex; gap: 8px; margin: 16px 0 6px; }
.author-hit { display: flex !important; align-items: center; gap: 14px; }
.hit-text { min-width: 0; }
.hit-text .j-title { display: block; }
.badges-hit { margin-top: 5px; }
.hit-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; flex: none;
}
.hit-letter {
  background: #dfe4ea; color: var(--bar-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 19px; font-weight: 600;
}

/* ---------------- shelf / hub lists ---------------- */
.shelf-list { list-style: none; margin: 18px 0 0; padding: 0; }
.shelf-list li { margin-bottom: 12px; }
.shelf-list a {
  display: block;
  background: var(--bar);
  border-radius: 14px;
  box-shadow: 0 1px 3px var(--shadow);
  padding: 16px 18px;
  text-decoration: none; color: var(--bar-ink);
}
.shelf-list .j-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 17px; font-weight: 600;
}
.shelf-list .j-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* The pinned welcome journal — the shelf's permanent first card and the
   site's only pitch surface. A quiet blue wash in the house accent so new
   readers start there; everything else on the shelf stays plain white. */
.shelf-list li.pinned a {
  background: #eef4fb;
  border: 1px solid #cfdff0;
  box-shadow: 0 1px 3px var(--shadow);
}
.pinned-tag {
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 4px;
}

.hub-head {
  text-align: center; margin: 8px 0 4px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 22px; font-weight: 600; color: var(--bar-ink);
}

/* ---------------- footer ---------------- */
.site-footer {
  text-align: center;
  padding: 26px 24px 34px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}
.site-footer .house {
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--bar-ink); font-size: 14px;
}
.site-footer .stores {
  display: flex; justify-content: center; gap: 8px; margin-top: 10px;
}
.site-footer .stores span {
  border: 1px solid rgba(35, 54, 74, .25);
  border-radius: 15px; padding: 5px 13px;
  font-size: 11.5px; color: var(--bar-ink);
  position: relative; cursor: default;
}
/* Pre-launch: badges are inert; hover/tap says so ("coming soon" pills until
   the store URLs exist — swap spans for real links at approval time). */
.site-footer .stores span::after {
  content: "Coming soon";
  position: absolute; left: 50%; bottom: calc(100% + 7px);
  transform: translateX(-50%) translateY(2px);
  background: var(--bar-ink); color: #fff;
  border-radius: 6px; padding: 3px 9px;
  font-size: 10.5px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.site-footer .stores span:hover::after,
.site-footer .stores span:active::after {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ---------------- lightbox: open/close only ---------------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(10, 12, 16, .9);
  display: none; align-items: center; justify-content: center;
  padding: 24px; z-index: 50; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox figure { margin: 0; width: 100%; max-width: 640px; }
.lightbox img { width: 100%; border-radius: 4px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lightbox figcaption { color: #cfd3da; text-align: center; margin-top: 12px; font-size: 13px; }
.lightbox .close-hint { color: #8b919b; font-size: 11px; margin-top: 4px; text-align: center; }

@media (prefers-reduced-motion: reduce) { .polaroid { transition: none; } }

/* ---------------- traveler badges + the show-only filter ----------------
   Three equal descriptor chips (Sober / Solo / Slow): same size, same blue,
   same weight. A chip is a description, never a status mark; no chip is
   visually nothing. */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badges-center { justify-content: center; margin: -2px 0 8px; }
.badges-card { margin-top: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500; letter-spacing: .02em;
  color: var(--accent);
  background: #eef4fb;
  border: 1px solid #cfdff0;
  border-radius: 12px;
  padding: 3px 9px 3px 7px;
  line-height: 1.2;
  white-space: nowrap;
}
.badge svg { width: 14px; height: 14px; flex: none; }

/* Shelf pages (home, country hubs): the filter rides in a rail on wide
   screens and folds ABOVE the list on phones (a reader must see the switch
   before the shelf, or the promise "never read it" is empty). */
.rail-filter { display: block; order: -1; }
@media (min-width: 1100px) {
  .layout-shelf { grid-template-columns: minmax(0, 700px) 240px; }
  .rail-filter { order: 0; }
  .rail-filter .filter-panel { position: sticky; top: 78px; }
}
.filter-panel {
  background: var(--bar);
  border-radius: 14px;
  box-shadow: 0 1px 3px var(--shadow);
  padding: 14px 16px 12px;
}
.filter-panel h4 {
  margin: 0 0 2px;
  font-size: 11px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.filter-sub { margin: 0 0 10px; font-size: 13px; color: var(--bar-ink); }
.filter-opt {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 10px 8px 0;
  cursor: pointer; user-select: none;
}
.filter-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.filter-opt .badge { font-size: 13px; padding: 6px 12px 6px 9px; border-radius: 16px; }
.filter-opt .badge svg { width: 16px; height: 16px; }
.filter-opt input:checked + .badge {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.filter-opt input:focus-visible + .badge { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (min-width: 1100px) {
  .filter-opt { display: flex; margin: 0 0 8px; }
  .filter-opt .badge { width: 100%; }
}
.filter-note { margin: 4px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.filter-empty {
  text-align: center; color: var(--muted); font-size: 14px;
  margin: 24px 0;
}
.filter-clear {
  background: none; border: 0; padding: 0;
  font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer;
}
.shelf-list li[hidden] { display: none; }
html.app-mode .rail-filter { display: none; }

/* ---------------- app mode (?app=1: the authoring app In Print webview) --
   Scoped to ONE journal: site chrome disappears, byline stays as plain
   text. Link scoping (same-journal only) lives in site.js. */
html.app-mode .site-header,
html.app-mode .site-footer,
html.app-mode .rail { display: none; }
/* App-mode copy swaps (In Print webview): the app is never a reader for
   other people's journals, so web exits hide and app instructions show. */
.app-only { display: none; }
html.app-mode .app-only { display: block; }
html.app-mode .web-only { display: none; }
html.app-mode .byline a { pointer-events: none; }
/* 404: one page, the line picked by the path (journal / author / bare). */
.miss-journal-line, .miss-author-line { display: none; }
html.miss-journal .miss-journal-line { display: block; }
html.miss-author .miss-author-line { display: block; }

/* ---------------- legal pages (/terms/, /privacy/) ---------------- */
.site-footer .legal-links { margin-top: 10px; }
.site-footer .legal-links a { color: var(--muted); text-decoration: underline; }
.legal { max-width: 640px; margin: 0 auto; color: #3a4250; font-size: 15px; line-height: 1.75; }
.legal .legal-date { color: var(--muted); font-size: 13px; text-align: center; margin-top: -8px; }
.legal h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 19px; font-weight: 600; color: var(--bar-ink);
  margin: 26px 0 8px;
}
.legal ul { padding-left: 22px; }
.legal li { margin: 6px 0; }
.legal a { color: #3b6ea5; }
