/* ============================================================
   The Long Way — a journal of everyday city life
   Palette: plaster paper, green-black ink, municipal green,
   signal yellow. Category plates use wayfinding colors.
   ============================================================ */

@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype");
  font-weight: 200 700;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --paper: #edece4;
  --paper-bright: #fbfaf4;
  --ink: #212b23;
  --ink-soft: #55604f;
  --green: #1f4a35;
  --green-deep: #143527;
  --yellow: #f2c43d;
  --rule: #212b23;
  --rule-soft: #c4c3b2;

  --plate-places: #2e6b4f;
  --plate-movement: #2f5e9e;
  --plate-food: #b4551e;
  --plate-people: #a63d33;
  --plate-culture: #6e4e7b;

  --display: "Oswald", "Arial Narrow", sans-serif;
  --body-face: "Literata", Georgia, serif;
  --ui: "DM Sans", system-ui, sans-serif;

  --radius: 3px;
  --measure: 66ch;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.55;
}

img { max-width: 100%; display: block; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 30;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 120ms ease;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------
   Masthead
   ------------------------------------------------------------ */

.masthead {
  background: var(--green-deep);
  color: var(--paper);
}

.masthead-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 28px 0;
}

.masthead-kicker {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(237, 236, 228, 0.75);
}

.masthead-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}

.masthead-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(3rem, 6.5vw, 5.25rem);
  line-height: 0.98;
  letter-spacing: 0.01em;
}

.masthead-sub {
  margin: 0 0 10px;
  max-width: 34ch;
  font-family: var(--body-face);
  font-style: italic;
  font-size: 17px;
  line-height: 1.5;
  color: rgba(237, 236, 228, 0.85);
}

/* Road-marking dashed line */
.roadline {
  margin-top: 26px;
  height: 7px;
  background: repeating-linear-gradient(
    to right,
    var(--yellow) 0 46px,
    transparent 46px 78px
  );
}

/* ------------------------------------------------------------
   Toolbar: search, topic, saved toggle
   ------------------------------------------------------------ */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 2px solid var(--rule);
}

.toolbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

.field { display: flex; flex-direction: column; gap: 4px; }

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input,
.field select {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 8px 12px;
  min-width: 0;
}

.field-search input { width: 250px; }
.field-topic select { width: 180px; }

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 1px;
  transition: background 140ms ease, color 140ms ease;
}
.saved-toggle:hover { background: var(--yellow); }

.saved-dot {
  width: 11px; height: 11px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  flex: none;
}
.saved-toggle[aria-pressed="true"] {
  background: var(--yellow);
}
.saved-toggle[aria-pressed="true"] .saved-dot {
  background: var(--ink);
}

.count {
  margin: 0 0 8px auto;
  font-size: 13.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Story index
   ------------------------------------------------------------ */

.stories {
  max-width: 1180px;
  margin: 0 auto;
  padding: 6px 28px 56px;
}

.plate {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fdfcf7;
  background: var(--plate, var(--green));
  padding: 3px 9px 4px;
  border-radius: var(--radius);
  white-space: nowrap;
}
.plate-Places { --plate: var(--plate-places); }
.plate-Movement { --plate: var(--plate-movement); }
.plate-Food { --plate: var(--plate-food); }
.plate-People { --plate: var(--plate-people); }
.plate-Culture { --plate: var(--plate-culture); }

/* Featured story */

.featured {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 44px;
  align-items: center;
  padding: 40px 0 44px;
}

.featured-text .plate { margin-bottom: 16px; }

.featured-meta {
  display: block;
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.featured-title {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.1rem, 3.6vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: 0.005em;
}

.featured-title .open-item {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline transparent;
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
  transition: text-decoration-color 140ms ease;
}
.featured-title .open-item:hover,
.featured-title .open-item:focus-visible {
  text-decoration-color: var(--yellow);
}

.featured-summary {
  margin: 0 0 14px;
  font-family: var(--body-face);
  font-size: 17.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 52ch;
}

.featured-media {
  margin: 0;
}
.featured-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
}
.featured-media figcaption {
  padding-top: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* Index rows */

.row {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 28px;
  padding: 26px 0;
  border-top: 2px solid var(--rule);
}

.row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  padding-top: 5px;
}

.row-date {
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.row-heading {
  margin: 0;
}

.row-title {
  display: inline;
  margin: 0;
  font-family: var(--body-face);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.22;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline transparent;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
  transition: text-decoration-color 140ms ease;
}
.row-title:hover,
.row-title:focus-visible {
  text-decoration-color: var(--yellow);
}

.row-summary {
  margin: 8px 0 0;
  font-family: var(--body-face);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 62ch;
}

.row-byline {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------
   Empty state — a taped notice
   ------------------------------------------------------------ */

.empty {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 28px 70px;
}

.empty-notice {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  background: var(--paper-bright);
  border: 2px dashed var(--ink);
  border-radius: 6px;
  padding: 34px 34px 30px;
  text-align: center;
  transform: rotate(-0.7deg);
}

.empty-notice::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 92px;
  height: 24px;
  transform: translateX(-50%) rotate(1.4deg);
  background: var(--yellow);
  opacity: 0.85;
  border-radius: 2px;
}

.empty-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
}

.empty-body {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--ink-soft);
}

.empty-action {
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 14.5px;
}
.empty-action:hover { background: var(--green); border-color: var(--green); }

/* ------------------------------------------------------------
   Article view
   ------------------------------------------------------------ */

.detail { min-height: 70vh; }

.detail-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 2px solid var(--rule);
}

.detail-bar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bar-button {
  font-size: 14.5px;
  font-weight: 600;
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 8px 14px;
  transition: background 140ms ease, color 140ms ease;
}
.bar-button:hover { background: var(--ink); color: var(--paper); }

.save-button[aria-pressed="true"] {
  background: var(--yellow);
}
.save-button[aria-pressed="true"]:hover {
  background: var(--ink);
  color: var(--paper);
}

.article {
  max-width: 820px;
  margin: 0 auto;
  padding: 44px 28px 72px;
  animation: settle 260ms ease both;
}

@keyframes settle {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.article-head .plate { margin-bottom: 18px; }

.article-title {
  margin: 0 0 16px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: 0.005em;
}

.article-byline {
  margin: 0 0 30px;
  padding-bottom: 22px;
  border-bottom: 2px solid var(--rule);
  font-size: 14.5px;
  color: var(--ink-soft);
}

.article-media { margin: 0 0 34px; }
.article-media img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--radius);
}
.article-media figcaption {
  padding-top: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.article-body { max-width: var(--measure); }

.article-body p {
  margin: 0 0 1.35em;
  font-family: var(--body-face);
  font-size: 1.14rem;
  line-height: 1.78;
}

.article-body p:first-of-type::first-letter {
  float: left;
  font-family: var(--body-face);
  font-weight: 600;
  font-size: 3.6em;
  line-height: 0.82;
  padding: 4px 10px 0 0;
  color: var(--green);
}

.article-end {
  margin: 44px 0 0;
  height: 7px;
  width: 156px;
  background: repeating-linear-gradient(
    to right,
    var(--yellow) 0 26px,
    transparent 26px 42px
  );
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */

.footer {
  margin-top: 24px;
  background: var(--green-deep);
  color: var(--paper);
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 28px 52px;
}

.footer-name {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.6rem;
}

.footer-note {
  margin: 0 0 18px;
  max-width: 58ch;
  font-size: 13.5px;
  color: rgba(237, 236, 228, 0.75);
}

.footer-kettle {
  margin: 0;
  font-family: var(--body-face);
  font-style: italic;
  font-size: 17px;
  color: var(--yellow);
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 720px) {
  .masthead-inner { padding: 24px 20px 0; }
  .masthead-row { gap: 14px; }
  .masthead-sub { margin-bottom: 0; font-size: 15.5px; }
  .roadline { margin-top: 20px; }

  .toolbar-inner { padding: 12px 20px; gap: 12px; }
  .field-search { flex: 1 1 100%; }
  .field-search input { width: 100%; }
  .count { margin-left: 0; flex-basis: 100%; order: 5; }

  .stories { padding: 0 20px 48px; }

  .featured {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 26px 0 30px;
  }
  .featured-media { order: -1; }

  .row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 22px 0;
  }
  .row-meta {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding-top: 0;
  }
  .row-title { font-size: 1.35rem; }
  .row-summary { margin-top: 4px; }

  .empty { padding: 20px 20px 60px; }
  .empty-notice { padding: 28px 22px 26px; }

  .detail-bar-inner { padding: 10px 16px; }
  .article { padding: 30px 20px 60px; }
  .article-body p { font-size: 1.06rem; }
}

/* ------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------ */

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