/* Screen: almanac (overlay) — C7's Almanac at home (src/ui/screens/almanac.js): this season, the year as four
   cards (a row of 4 on wide screens, 2 × 2 on a phone), the home news coming up with its odds dots, Pip's
   record, the 📻 Harbor Radio card (full width, slice 3). Also the top bar's home chip as a button that opens
   it (components/topbar.js, C7), and the Rivals page's "📰 Reads the news." line (screens/logbook.js, slice 5). */

.screen--almanac {
  gap: var(--sp-4);
}

.screen--almanac.is-rerender {
  animation: none;
}

/* ── Header ────────────────────────────────────────────── */
.al-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.al-head__sub {
  margin-top: var(--sp-1);
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink-soft);
}

/* ── Cards ─────────────────────────────────────────────── */
.al-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    'season coming'
    'year year'
    'radio radio';
  gap: var(--sp-4) var(--sp-5);
  align-items: start;
}

.al-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid rgba(13, 48, 71, 0.06);
  box-shadow: var(--shadow-2);
}

.al-card__title {
  font-size: var(--fs-md);
  color: var(--sea-800);
}

/* This season: the name big, then the next season's first day, its words, fuel. */
.al-season {
  grid-area: season;
  background:
    radial-gradient(420px 160px at 0% 0%, var(--green-100) 0%, rgba(227, 243, 218, 0) 70%),
    var(--card);
}

.al-season__name {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xl);
  font-weight: 900;
  color: var(--ink);
  line-height: 1.2;
}

.al-season__emoji {
  font-size: 1.3em;
  line-height: 1;
}

.al-season__next {
  font-weight: 800;
  color: var(--sea-700);
}

.al-season__text,
.al-season__fuel {
  color: var(--ink-soft);
  font-weight: 700;
}

/* The year: four cards; a tap reads one (its line under the row). */
.al-year {
  grid-area: year;
}

.al-year__row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
}

.al-year__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  min-height: var(--tap);
  padding: var(--sp-3) var(--sp-2);
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sand-50);
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.al-year__card:hover {
  border-color: var(--sea-300);
}

.al-year__card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.al-year__card.is-now {
  border-color: var(--green-500);
  background: var(--green-100);
}

.al-year__card.is-open {
  border-color: var(--sea-500);
  box-shadow: inset 0 0 0 1px var(--sea-500);
}

.al-year__emoji {
  font-size: 2rem;
  line-height: 1;
}

.al-year__name {
  font-weight: 900;
  line-height: 1.2;
}

.al-year__when {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-faint);
}

.al-year__now {
  background: var(--green-500);
  color: #fff;
  font-weight: 900;
}

.al-year__line {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--sea-50);
  font-weight: 700;
  color: var(--ink);
}

.al-year__line[hidden] {
  display: none;
}

/* Coming up: each news item with its odds dots (the words already say "8 in 10"). */
.al-coming {
  grid-area: coming;
}

.al-coming__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.al-coming__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    'emoji text'
    'emoji dots';
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--accent-100);
}

.al-coming__emoji {
  grid-area: emoji;
  font-size: 1.8rem;
  line-height: 1;
}

.al-coming__text {
  grid-area: text;
  font-weight: 800;
}

.al-coming__item .odds {
  grid-area: dots;
  justify-self: start;
}

.al-coming__none {
  font-weight: 700;
}

.al-record {
  font-weight: 800;
  color: var(--sea-800);
}

/* A coming item the Harbor Radio called (its words carry the 📻 mark). */
.al-coming__item.is-radio {
  background: var(--sea-100);
}

/* ── The 📻 Harbor Radio card (slice 3): full width under the year ── */
.al-radio {
  grid-area: radio;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'title buy'
    'pitch buy'
    'state buy';
  align-items: center;
  column-gap: var(--sp-5);
}

.al-radio .al-card__title {
  grid-area: title;
}

.al-radio__pitch {
  grid-area: pitch;
  color: var(--ink-soft);
  font-weight: 700;
}

.al-radio__state {
  grid-area: state;
  font-weight: 800;
}

.al-radio.is-on .al-radio__state {
  color: var(--sea-800);
}

.al-radio__buy {
  grid-area: buy;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-1);
}

.al-radio__why {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
}

.al-foot {
  display: flex;
  justify-content: center;
}

/* ── The top bar's home chip, a button that opens the Almanac (in port) ── */
.topbar__region.is-button {
  min-height: var(--tap);
  padding: 0.2em 0.6em 0.2em 0.9em;
  border: 2px solid var(--sea-300);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.topbar__region.is-button:hover {
  background: var(--sea-100);
}

.topbar__region.is-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.topbar__region-go {
  font-size: 1.15em;
  line-height: 1;
}

/* ── The market's header: "📔 Almanac" beside the way back (screens/market.js, C7) ── */
.mk-head__btns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* ── The Rivals page: "📰 Reads the news." on a captain who reads it (screens/logbook.js, C7 slice 5) ── */
.lb-captain__news {
  align-self: flex-start;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-md);
  background: var(--sea-50);
  color: var(--sea-800);
  font-size: var(--fs-sm);
  font-weight: 700;
}

/* ── Phones and narrow tablets ─────────────────────────── */
@media (max-width: 53.75em) {
  .al-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'season'
      'coming'
      'year'
      'radio';
  }
}

@media (max-width: 37.5em) {
  .al-head .btn {
    width: 100%;
  }

  .al-head__sub {
    font-size: var(--fs-base);
  }

  .al-card {
    padding: var(--sp-4);
  }

  .al-season__name {
    font-size: var(--fs-lg);
  }

  .al-year__row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* The odds dots take the item's whole width (ten dots stay on one line at 320 px). */
  .al-coming__item {
    grid-template-areas:
      'emoji text'
      'dots dots';
  }

  .al-foot .btn {
    width: 100%;
  }

  /* The radio's button goes under its words, full width. */
  .al-radio {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'title'
      'pitch'
      'state'
      'buy';
    row-gap: var(--sp-2);
  }

  .al-radio__buy .btn {
    width: 100%;
  }

  .mk-head__btns {
    width: 100%;
  }
}
