/* First Days Guide
   1. Tokens   2. Page   3. Search   4. Roadmap   5. Credits   6. Topic panel   7. Topic content */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* The Irish tricolour, used as-is for the strip at the top of the page. */
  --flag-green: #169b62;
  --flag-white: #ffffff;
  --flag-orange: #ff883e;

  --bg: #f5f8f3;
  --surface: #ffffff;
  --fg: #14241c;
  --muted: #56675e;
  --line: #d5dfd8;
  --green: #0e7c4a;       /* fills; dark enough for white text */
  --on-green: #ffffff;
  --green-ink: #0b6a3f;   /* green text on light surfaces */
  --green-soft: #e1f1e8;
  --orange: #e8650f;      /* borders, dotted lines, focus rings */
  --orange-soft: #fbe0cc; /* hover ring */

  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1713;
    --surface: #17211b;
    --fg: #e6ede9;
    --muted: #9aaaa2;
    --line: #2b3831;
    --green-ink: #6fcf9f;
    --green-soft: #1d3329;
    --orange: #ff883e;
    --orange-soft: #4a2c17;
  }
}

/* 2. Page ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

/* Stop the page scrolling behind the open topic panel. */
html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 var(--body);
}

.flag {
  height: 6px;
  background: linear-gradient(
    90deg,
    var(--flag-green) 0 33.33%,
    var(--flag-white) 33.33% 66.66%,
    var(--flag-orange) 66.66% 100%
  );
}

.hero {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 16px 8px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green-ink);
}

h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(34px, 7vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.sub {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
  color: var(--muted);
  text-wrap: balance;
}

.lede {
  max-width: 52ch;
  margin: 0 auto;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 16px 72px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin: 0 0 40px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--muted);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key {
  width: 22px;
  height: 14px;
  border: 1.5px solid var(--orange);
  border-radius: 4px;
  background: var(--surface);
}

.key--todo {
  border-style: dashed;
  background: none;
}

footer {
  padding: 0 16px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

footer p {
  margin: 0;
}

.signature {
  margin-top: 20px;
  font-size: 11px;
  opacity: 0.8;
}

.signature a {
  color: inherit;
  text-underline-offset: 2px;
}

.signature a:hover {
  color: var(--green-ink);
}

.signature a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 2px;
}

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

/* 3. Search ---------------------------------------------------------------- */

.search {
  position: relative;
  max-width: 560px;
  margin: 0 auto 24px;
}

.search input {
  width: 100%;
  height: 48px;
  padding: 0 44px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 16px; /* 16px or more stops iOS zooming in on focus */
}

.search input::placeholder {
  color: var(--muted);
}

.search input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
}

.search-icon {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.search-key {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font: 13px/22px var(--body);
  text-align: center;
  pointer-events: none;
}

.search:focus-within .search-key,
.search input:not(:placeholder-shown) ~ .search-key {
  display: none;
}

@media (hover: none) {
  .search-key {
    display: none;
  }

  .search input {
    padding-right: 14px;
  }
}

.search-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 10;
  max-height: min(60vh, 480px);
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(8 20 14 / 0.18);
}

.search-panel ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-opt {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.search-opt:not([aria-disabled]):hover,
.search-opt[aria-selected="true"] {
  background: var(--green-soft);
}

.search-opt[aria-disabled] {
  cursor: default;
  opacity: 0.7;
}

.search-crumb {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.search-title {
  font-weight: 600;
}

.search-snippet {
  font-size: 14px;
  color: var(--muted);
}

.search mark {
  padding: 0 1px;
  border-radius: 2px;
  background: var(--orange-soft);
  color: inherit;
}

.search-empty {
  margin: 0;
  padding: 10px;
  font-size: 14px;
  color: var(--muted);
}

/* 4. Roadmap --------------------------------------------------------------- */

.roadmap {
  position: relative;
}

/* The connector lines. js/app.js writes the path data. */
.wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.wires path {
  fill: none;
  stroke-width: 2;
}

.wire-spine {
  stroke: var(--green);
}

.wire-branch {
  stroke: var(--orange);
  stroke-dasharray: 1 6;
  stroke-linecap: round;
}

.stages,
.branch {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stages {
  position: relative;
  gap: 36px;
}

/* Phones: one column, each stage followed by its topics. */
.stage {
  display: grid;
  justify-items: center;
  row-gap: 16px;
}

.branch {
  gap: 16px;
}

/* Wider screens: topics | stage | topics. */
@media (min-width: 720px) {
  .stage {
    grid-template-columns: minmax(0, 1fr) 220px minmax(0, 1fr);
    column-gap: 56px;
    align-items: center;
    justify-items: stretch;
  }

  .stage > * {
    grid-row: 1;
  }

  .stage > .node {
    grid-column: 2;
  }

  .branch {
    gap: 10px;
  }

  .branch--left {
    grid-column: 1;
    justify-self: end;
  }

  .branch--right {
    grid-column: 3;
    justify-self: start;
  }
}

.node {
  display: block;
  padding: 9px 14px;
  border: 1.5px solid var(--orange);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
}

.node--stage {
  width: min(220px, 100%);
  padding: 12px 16px;
  border-color: var(--green);
  background: var(--green);
  color: var(--on-green);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.node.is-todo {
  border-style: dashed;
  background: none;
  color: var(--muted);
}

.node--stage.is-todo {
  background: var(--green-soft);
  color: var(--green-ink);
}

.node-no {
  margin-right: 8px;
  font-size: 0.85em;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

a.node {
  transition: box-shadow 0.15s;
}

a.node:hover {
  box-shadow: 0 0 0 4px var(--orange-soft);
}

a.node:focus-visible,
.drawer-close:focus-visible,
.topic a:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.notice {
  max-width: 52ch;
  margin: 0 auto;
  text-align: center;
  color: var(--muted);
}

/* 5. Credits --------------------------------------------------------------- */

.credits {
  display: grid;
  gap: 20px;
  max-width: 760px;
  margin: 96px auto 0;
}

.credits h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(28px, 5vw, 36px);
  line-height: 1.1;
  text-align: center;
}

.credits-lede {
  max-width: 48ch;
  margin: 0 auto;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}

/* Column widths follow the photos' shapes (16:9 and 9:16), so both end up the same height. */
.credits-photos {
  display: grid;
  grid-template-columns: minmax(0, 1.7778fr) minmax(0, 0.5625fr);
  gap: 10px;
}

.credits-photos img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  /* An outline, not a border: a border would add 2px to each photo and break the equal heights. */
  outline: 1px solid var(--line);
  outline-offset: -1px;
}

.credits-photos a:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
  border-radius: 10px;
}

@media (max-width: 560px) {
  .credits-photos {
    grid-template-columns: 1fr;
  }

  /* A full-width portrait photo would be taller than the screen. */
  .credits-photos a:last-child {
    justify-self: center;
    width: 70%;
  }
}

.credits-list {
  margin: 0;
}

.credits-list div {
  display: grid;
  grid-template-columns: 11em 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.credits-list div:last-child {
  border-bottom: 1px solid var(--line);
}

.credits-list dt {
  font-weight: 600;
  color: var(--green-ink);
}

.credits-list dd {
  margin: 0;
}

@media (max-width: 420px) {
  .credits-list div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* 6. Topic panel ----------------------------------------------------------- */

.drawer {
  width: min(600px, 100%);
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto; /* pin to the right edge */
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  overflow-y: auto;
}

.drawer::backdrop {
  background: rgb(8 20 14 / 0.5);
}

/* Fills the dialog, so a click on the dialog element itself means the backdrop. */
.drawer-panel {
  min-height: 100%;
}

.drawer-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.drawer-crumb {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--fg);
  font-size: 16px;
  cursor: pointer;
}

.drawer-close:hover {
  background: var(--green-soft);
}

/* 7. Topic content --------------------------------------------------------- */
/* Styles for the HTML in content/*.html. See content/_template.html. */

.topic {
  display: grid;
  gap: 10px;
  padding: 24px 20px 48px;
  font-size: 15px;
}

.topic > * {
  min-width: 0;
}

.topic h2,
.topic h3,
.topic h4,
.topic p,
.topic ul,
.topic ol {
  margin: 0;
}

.topic h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
  text-wrap: balance;
}

.topic h3 {
  margin-top: 14px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  color: var(--green-ink);
}

.topic ul,
.topic ol {
  display: grid;
  gap: 4px;
  padding-left: 1.3em;
}

.topic a {
  color: var(--green-ink);
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

/* Tip with a small label: <p class="hint"><span>Hint</span> text</p> */
.topic .hint {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}

.hint span {
  flex: none;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--green-soft);
  color: var(--green-ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Stack of cards: .docs > .doc > .doc-h, .for, p */
.docs {
  display: grid;
  gap: 12px;
}

.doc {
  display: grid;
  gap: 3px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--orange);
}

.doc-h {
  font-size: 15px;
  font-weight: 600;
}

.doc .for {
  font-size: 14px;
  color: var(--muted);
}

/* Things to say: <ul class="phrases"> */
.topic .phrases {
  gap: 6px;
  padding-left: 0;
  list-style: none;
}

.phrases li {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--green-soft);
}

/* Opening hours: <table class="hours"> */
.hours {
  margin: 4px 0;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.hours th {
  padding: 2px 16px 2px 0;
  text-align: left;
  font-weight: 500;
  color: var(--muted);
}

.hours td {
  padding: 2px 0;
}

.topic .links {
  font-size: 14px;
  line-height: 1.7;
}

/* Label and value rows: <ul class="facts"><li><span class="k">…</span><span>…</span></li></ul> */
.topic .facts {
  gap: 0;
  padding-left: 0;
  list-style: none;
}

.facts li {
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.facts li:last-child {
  border-bottom: 1px solid var(--line);
}

.facts li > span {
  min-width: 0;
}

.facts .k {
  font-weight: 600;
}

/* Inside a card the rows are smaller, so a place's hours and prices stay compact. */
.doc .facts {
  margin: 4px 0;
}

.doc .facts li {
  grid-template-columns: 6.5em 1fr;
  padding: 4px 0;
  font-size: 14px;
}

/* Picture: <figure><img src="content/img/…" alt="…" width="…" height="…"><figcaption>…</figcaption></figure> */
.topic figure {
  display: grid;
  gap: 6px;
  margin: 4px 0;
}

.topic img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topic figcaption {
  font-size: 13px;
  color: var(--muted);
}

/* Someone's own words: <blockquote><p>…</p></blockquote> */
.topic blockquote {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  background: var(--green-soft);
}

.topic .checked {
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 420px) {
  .facts li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
