/* Insights from the Last Analog Generation — shared site styles */

:root {
  --paper: #f7f2e8;
  --paper-deep: #efe7d8;   /* slightly darker paper, for text boxes */
  --ink: #2b2620;
  --muted: #6f6556;
  --rule: #d9cfbd;
  --accent: #a4572f;
  --banner: #2f3a33;
  --banner-ink: #f7f2e8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header banner (same on every page) */
header {
  background: var(--banner);
  color: var(--banner-ink);
  padding: 1.25rem 1.5rem 1.1rem;
  text-align: center;
  border-bottom: 4px solid var(--accent);
}
header h1 {
  font-weight: normal;
  font-size: clamp(1.35rem, 3.2vw, 2.05rem);
  letter-spacing: 0.01em;
  line-height: 1.2;
}
header h1 a { color: inherit; text-decoration: none; }
header h1 span { display: block; }
header p {
  margin-top: 0.45rem;
  font-size: clamp(0.8rem, 1.4vw, 0.9rem);
  font-style: italic;
  opacity: 0.8;
}

/* Navigation: text-only links, rust underline marks the current page */
nav.site-nav { padding: 1.1rem 1.5rem 0; }
nav.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 2.25rem;
}
nav.site-nav a {
  display: inline-block;
  padding: 0.3rem 0.1rem 0.35rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
nav.site-nav a:hover,
nav.site-nav a:focus-visible { color: var(--ink); border-bottom-color: var(--rule); }
nav.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* Thin separator between navigation and page content:
   hairlines that fade at the ends, with a small rust diamond at the center */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(36rem, 86vw);
  margin: 1rem auto 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 2px;
}
.divider::before { background: linear-gradient(to right, transparent, var(--rule)); }
.divider::after  { background: linear-gradient(to left, transparent, var(--rule)); }
.divider span {
  width: 5px;
  height: 5px;
  background: var(--accent);
  transform: rotate(45deg);
}

/* Main content */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.75rem 1.5rem 3rem;
  text-align: center;
}
.art { width: min(300px, 78vw); height: auto; }
main .eyebrow {
  margin-top: 1.75rem;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
main h2 {
  margin-top: 0.4rem;
  font-weight: normal;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
main .art + h2 { margin-top: 1.75rem; }

/* Text box: a reusable block of reading text on slightly darker paper */
.text-box {
  max-width: 38rem;
  margin: 0 auto 2.5rem;
  padding: 1.4rem clamp(1.1rem, 4vw, 1.75rem);
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  text-align: left;
}
.text-box p {
  font-size: 1.05rem;
  line-height: 1.7;
}
main .lede {
  margin-top: 1rem;
  max-width: 34rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--muted);
}
main .cta {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.8rem 1.6rem;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: 0.03em;
  transition: background 0.2s, color 0.2s;
}
main .cta:hover, main .cta:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

footer {
  border-top: 1px solid var(--rule);
  padding: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Forms (Submit page) ─────────────────────────────────────────────── */

/* .page = the standard content column for any page with forms or reading text */
.page, .submit-form, .thanks {
  width: 100%;
  max-width: 40rem;
  text-align: left;
}
main:has(.page) { justify-content: flex-start; padding-top: 2.5rem; }

.page .notice {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--paper-deep);
  border-left: 3px solid var(--accent);
  font-size: 0.95rem;
  color: var(--muted);
}

.page h2 {
  margin-top: 0;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  text-transform: none;
}
.page h2:focus { outline: none; }
.page .intro { margin: 0.2rem 0 2rem; color: var(--muted); line-height: 1.6; }

.field { margin-bottom: 0.75rem; }
.field label, .field .label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 1.02rem;
}
.hint { margin-top: 0.35rem; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
.count, .optional { color: var(--muted); font-size: 0.88rem; }

input[type="text"], input[type="email"], input[type="search"], select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.875rem;   /* 14px; was 16px */
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid #cfc3ad;
  border-radius: 2px;
}
textarea {
  line-height: 1.6;
  resize: vertical;      /* people can make it taller */
  overflow-y: auto;      /* and it scrolls once the text runs long */
}
#story { min-height: 8.5rem; max-height: 36rem; }
#lesson { min-height: 4rem; max-height: 20rem; }

/* Hints shown inside the boxes: dim and italic, gone as soon as typing starts */
::placeholder { color: var(--muted); opacity: 0.75; font-style: italic; }

/* Text for screen readers only */
.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;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
[aria-invalid="true"] { border-color: #9c2f1f; }

.field-error { margin-top: 0.35rem; font-size: 0.9rem; color: #9c2f1f; }
.field-error:empty { display: none; }

fieldset {
  border: 0;
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
  margin-bottom: 0.75rem;
}
legend {
  padding-right: 0.75rem;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.choices { display: flex; flex-direction: column; gap: 0.5rem; }
.choices-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.5rem 1rem; }
.field label.choice { margin-bottom: 0; }
.choice, .field label.choice { display: flex; gap: 0.55rem; align-items: baseline; line-height: 1.45; cursor: pointer; font-size: 1rem; }
.choice input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; flex: none; transform: translateY(0.15rem); }
.choice.is-disabled { color: var(--muted); opacity: 0.6; cursor: not-allowed; }
.consent { margin-top: 0.5rem; padding: 0.85rem 1rem; background: var(--paper-deep); border: 1px solid var(--rule); }

.actions { display: flex; align-items: center; justify-content: flex-end; gap: 1.5rem; margin-top: 1.5rem; }
.actions .cta { margin-top: 0; cursor: pointer; background: none; font-family: inherit; }
.link-button {
  margin-right: auto;
  background: none;
  border: 0;
  font: inherit;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.link-button:hover { color: var(--ink); }

.form-message { margin-top: 1rem; padding: 0.75rem 1rem; border-left: 3px solid var(--accent); background: var(--paper-deep); }
.form-message.is-error { border-left-color: #9c2f1f; }

/* Spam trap: kept off-screen rather than display:none, which some bots skip */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Without JavaScript both screens show and the step buttons are hidden */
.js-only { display: none; }
.js .js-only { display: flex; }
.js .link-button.js-only { display: inline; }

.thanks { text-align: center; }
.thanks h2 { margin-top: 0; }

/* Pop-up multi-pick menu (assets/picker.js) */
.picker { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem 1.5rem; }
.picker-boxes[hidden], .newsletter[hidden] { display: none; }
.picker-menu { position: relative; width: 15rem; }
.picker-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid #cfc3ad;
  border-radius: 2px;
  cursor: pointer;
}
.picker-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.picker-button[aria-expanded="true"] .picker-caret { transform: rotate(180deg); }
.picker-caret { color: var(--muted); font-size: 0.8rem; }
.picker-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 10;
  list-style: none;
  padding: 0.3rem 0;
  background: #fffdf8;
  border: 1px solid #cfc3ad;
  border-radius: 2px;
  box-shadow: 0 6px 16px rgba(43, 38, 32, 0.12);
}
.picker-list:focus { outline: none; }
.picker-list [role="option"] {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.7rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.picker-list [role="option"].is-active, .picker-list [role="option"]:hover { background: var(--paper-deep); }
.picker-list [aria-disabled="true"] { color: var(--muted); opacity: 0.55; cursor: not-allowed; }
.picker-check { width: 1rem; color: var(--accent); font-weight: bold; }
.picker-chosen { list-style: none; padding-top: 0.5rem; }
.picker-chosen li { font-style: italic; line-height: 1.6; }

/* ── Search page ───────────────────────────────────────────────────── */
.search-row { display: flex; gap: 0.6rem; }
.search-row input { flex: 1; min-width: 0; }
.search-row .cta { margin-top: 0; padding: 0.55rem 1.25rem; font-size: 0.95rem; cursor: pointer; background: none; font-family: inherit; }
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.6rem; margin-top: 0.75rem; }
.filter-row .picker-menu { width: 12.5rem; }
.filter-row select { width: auto; min-width: 9.5rem; }
.filter-row .sort-select { margin-left: auto; }

.results-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  margin: 1.4rem 0 0.9rem; padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule); font-size: 0.9rem;
}
.results-bar[hidden] { display: none; }
.results-count strong { font-weight: 600; }
.results-chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 0.3rem; font-style: italic; color: var(--muted); }
.chip button { border: 0; background: none; font: inherit; font-style: normal; color: var(--accent); cursor: pointer; padding: 0 0.15rem; }
.results-clear { margin-left: auto; margin-right: 0; font-size: 0.85rem; }

.results { list-style: none; display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.25rem; }
.result-card {
  display: block; padding: 1rem 1.1rem 0.95rem;
  border: 1px solid var(--rule); background: #fbf7ef;
  color: var(--ink); text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.result-card:hover, .result-card:focus-visible { border-color: var(--accent); background: #fffdf8; }
.result-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.result-title { font-weight: normal; font-size: 1.2rem; line-height: 1.3; }
.result-meta { margin-top: 0.3rem; font-size: 0.8rem; color: var(--muted); }
.result-story, .result-lesson { margin-top: 0.6rem; font-size: 0.875rem; line-height: 1.6; }
.result-lesson { padding-left: 0.75rem; border-left: 2px solid var(--rule); font-style: italic; color: #4d453b; }
.result-title, .result-story, .result-lesson { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.result-title { -webkit-line-clamp: 2; line-clamp: 2; }
.result-story, .result-lesson { -webkit-line-clamp: 3; line-clamp: 3; }
mark { background: rgba(164, 87, 47, 0.16); color: inherit; padding: 0 1px; }

.results-empty { margin-top: 1.5rem; text-align: center; color: var(--muted); }
.results-empty[hidden] { display: none; }
.results-more { margin-top: 1.6rem; text-align: center; }
.results-more[hidden] { display: none; }
.results-more .cta { margin-top: 0; cursor: pointer; background: none; font-family: inherit; }
.results-shown { margin-top: 0.6rem; font-size: 0.8rem; color: var(--muted); }

/* ── Single story page ─────────────────────────────────────────────── */
.story-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 0.9rem; }
.story-nav a { color: var(--muted); text-decoration: none; }
.story-nav a:hover { color: var(--ink); }
.story-steps { display: flex; gap: 1.1rem; color: var(--muted); }
.story-steps[hidden], .story-steps [hidden] { display: none; }
.story { margin-top: 1.75rem; }
.page .story-title { font-size: 1.9rem; line-height: 1.25; letter-spacing: 0; }
.story-meta { margin-top: 0.6rem; font-size: 0.9rem; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.tag {
  padding: 0.2rem 0.65rem; border: 1px solid var(--rule); border-radius: 999px;
  font-size: 0.8rem; color: var(--muted); text-decoration: none;
}
.tag:hover, .tag:focus-visible { border-color: var(--accent); color: var(--accent); }
.tag-small { padding: 0.1rem 0.55rem; }
.box-label { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: normal; }
.lesson-box { margin-top: 1.6rem; padding: 1.1rem 1.4rem; background: var(--paper-deep); border: 1px solid var(--rule); }
.lesson-box .lesson { margin-top: 0.4rem; font-size: 1.12rem; line-height: 1.6; font-style: italic; }
.story-body { margin-top: 1.75rem; font-size: 1.06rem; line-height: 1.75; }
.story-body p + p { margin-top: 1.1rem; }
.story-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  margin-top: 1.6rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-size: 0.8rem; color: var(--muted);
}
.keywords { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.small-button {
  margin-left: auto; padding: 0.4rem 0.9rem; font: inherit; font-size: 0.8rem;
  color: var(--ink); background: none; border: 1px solid var(--ink); cursor: pointer;
}
.small-button:hover { background: var(--ink); color: var(--paper); }
.more { margin-top: 2.75rem; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.more-card {
  display: block; padding: 0.8rem 0.95rem; border: 1px solid var(--rule); background: #fbf7ef;
  color: var(--ink); text-decoration: none;
}
.more-card:hover, .more-card:focus-visible { border-color: var(--accent); background: #fffdf8; }
.more-title { display: block; font-size: 1rem; line-height: 1.35; }
.more-meta { display: block; margin-top: 0.3rem; font-size: 0.78rem; color: var(--muted); }
.invite { margin-top: 2.5rem; padding: 1.4rem; text-align: center; border: 1px solid var(--rule); }
.invite-title { font-size: 1.12rem; }
.invite-text { margin-top: 0.35rem; font-size: 0.9rem; color: var(--muted); }
.invite .cta { margin-top: 1rem; }
