/* TomTechLab homepage, concept A "Survey": the site as a map sheet of the Tyne valley.
   Cream paper, contour orange, river blue, woodland green. A night map in dark mode. */

:root {
  --paper: #f2ead8;
  --paper-2: #e9dfc7;
  --card: #f7f1e3;
  --ink: #2b2118;
  --ink-2: #4c3f33;
  --muted: #7a6a58;
  --contour: #c8763a;
  --water: #2f6f95;
  --wood: #5f8a4a;
  --grid: rgb(43 33 24 / 9%);
  --rule: rgb(43 33 24 / 22%);
  --dash: rgb(43 33 24 / 32%);
  --dark: #241c15;
  --dark-ink: #f2ead8;
  --dark-muted: #c4b59d;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1200px;
  --gutter: clamp(18px, 4vw, 48px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16130f;
    --paper-2: #221d17;
    --card: #1d1914;
    --ink: #efe5d0;
    --ink-2: #d6c9b1;
    --muted: #a8977f;
    --contour: #e08b4c;
    --water: #6fb0d6;
    --wood: #8cb874;
    --grid: rgb(239 229 208 / 6%);
    --rule: rgb(239 229 208 / 18%);
    --dash: rgb(239 229 208 / 28%);
    --dark: #0e0c09;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
.wrap { width: min(var(--wrap), 100% - var(--gutter) * 2); margin-inline: auto; }
.sr-only, .sprites { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; top: -60px; left: 12px; z-index: 100; padding: 10px 16px; background: var(--ink); color: var(--paper); }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--water); outline-offset: 3px; }
em { color: var(--water); font-style: italic; }

/* Buttons and links */
.btn { display: inline-flex; min-height: 48px; align-items: center; padding: 0 22px; border: 2px solid var(--ink); border-radius: 4px; font-size: 15px; font-weight: 650; transition: transform 140ms ease, box-shadow 140ms ease; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-small { min-height: 42px; padding: 0 16px; font-size: 14px; }
.link { display: inline-flex; gap: 6px; padding-block: 10px; color: var(--water); font-weight: 650; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.link::after { content: "→"; text-decoration: none; }
.ref { color: var(--contour); font-family: var(--mono); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }

/* Header: the sheet's title strip */
.sheet-head { position: sticky; top: 0; z-index: 50; border-bottom: 2px solid var(--ink); background: var(--paper); }
.head-inner { display: flex; height: 64px; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 22px/1 var(--serif); }
.brand img { border-radius: 6px; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a { padding: 10px 12px; font-family: var(--mono); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.site-nav a:hover { color: var(--contour); }
.nav-project { margin-left: 8px; border: 2px solid var(--ink); border-radius: 4px; }
.grid-ref { padding-left: 18px; border-left: 2px solid var(--ink); color: var(--contour); font-family: var(--mono); font-size: 13px; letter-spacing: .08em; }
.menu-toggle { display: none; }

/* Hero map */
.map { position: relative; overflow: hidden; background:
  linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 80px 80px,
  linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 80px 80px, var(--paper); }
.terrain { position: absolute; inset: 0; width: 100%; height: 100%; }
.contours path { fill: none; stroke: var(--contour); stroke-opacity: .5; stroke-width: 1.2; }
.contours .index { stroke-width: 2.2; stroke-opacity: .65; }
.river { fill: none; stroke: var(--water); stroke-width: 6; stroke-linecap: round; opacity: .65; }
.wood circle { fill: var(--wood); opacity: .45; }
.spot { fill: var(--ink-2); font: 12px var(--mono); letter-spacing: .08em; }
.spot.water { fill: var(--water); font-style: italic; }
@media (prefers-reduced-motion: no-preference) {
  /* The map fades in a layer at a time: contours, then the river. */
  .terrain .contours, .terrain .river, .terrain .wood { animation: surface 1.4s ease-out both; }
  .terrain .river { animation-delay: .35s; }
  .terrain .wood { animation-delay: .6s; }
}
@keyframes surface { from { opacity: 0; } }
.hero { min-height: calc(100svh - 64px); }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); align-items: start; gap: clamp(32px, 5vw, 64px); padding: clamp(48px, 8vw, 96px) 0 120px; }
h1 { margin-top: 18px; font: 600 clamp(56px, 8.5vw, 116px)/.92 var(--serif); letter-spacing: -.02em; }
.lead { max-width: 30em; margin-top: 26px; font: 21px/1.5 var(--serif); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.legend { margin-top: 24px; padding: 22px 24px; border: 2px solid var(--ink); background: color-mix(in srgb, var(--paper) 92%, transparent); box-shadow: 6px 6px 0 var(--rule); }
.legend h2 { margin-bottom: 10px; font: 600 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.legend li a { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px dashed var(--dash); font-weight: 550; }
.legend li a:hover { color: var(--water); }
.legend img { width: 34px; height: 34px; border-radius: 8px; }
.legend small { margin-left: auto; color: var(--contour); font: 12px var(--mono); }
.legend-status { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-top: 14px; border-top: 2px solid var(--ink); font: 13px var(--mono); }
.signal { width: 10px; height: 10px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }
.is-good .signal { background: var(--wood); } .is-warn .signal { background: var(--contour); }
.map-foot { position: absolute; right: 0; bottom: 28px; left: 0; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; font: 12px var(--mono); }
.scale { display: flex; align-items: center; gap: 10px; }
.scale i { display: block; width: 160px; height: 8px; border: 1.5px solid var(--ink); background: repeating-linear-gradient(90deg, var(--ink) 0 40px, var(--paper) 40px 80px); }
.north { font-weight: 700; text-align: center; }

/* Sections */
.section { padding: clamp(72px, 10vw, 128px) 0; border-top: 2px solid var(--ink); }
.section-tight { padding: clamp(56px, 7vw, 88px) 0; }
.section-head { max-width: 680px; margin-bottom: clamp(36px, 5vw, 56px); }
h2 { margin-top: 14px; font: 600 clamp(38px, 5vw, 64px)/1 var(--serif); letter-spacing: -.015em; }
.h-small { font-size: clamp(30px, 3.4vw, 40px); }
.section-head > p:not(.ref) { margin-top: 18px; color: var(--ink-2); font: 19px/1.55 var(--serif); }
.section-head .link { margin-top: 16px; }
h3 { font: 600 26px/1.1 var(--serif); }

/* Points of interest */
.poi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.poi-card { display: flex; flex-direction: column; gap: 14px; padding: 26px; border: 1.5px dashed var(--dash); background: var(--card); transition: border-color 160ms ease, transform 160ms ease; }
.poi-card:hover { border-style: solid; border-color: var(--ink); transform: translateY(-2px); }
.poi-wide { grid-column: 1 / -1; }
.poi-ref { display: flex; align-items: center; gap: 8px; color: var(--contour); font: 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.poi-ref svg { width: 16px; height: 16px; color: var(--ink); }
.poi-title { display: flex; align-items: center; gap: 18px; }
.poi-title img { width: 64px; height: 64px; border-radius: 15px; box-shadow: 0 10px 20px -12px rgb(0 0 0 / 55%); }
.poi-title h3 span { display: block; margin-top: 6px; color: var(--ink-2); font: italic 18px/1.3 var(--serif); }
.poi-card > p:not(.poi-ref):not(.poi-links) { color: var(--ink-2); }
.poi-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin-top: auto; padding-top: 6px; }
.survey { padding: 6px 12px; border: 1.5px dashed var(--dash); color: var(--muted); font: 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; }

/* Cross-section (dark band) */
.section-dark { background: var(--dark); color: var(--dark-ink); border-top-color: var(--dark); }
.section-dark .section-head > p:not(.ref) { color: var(--dark-muted); }
.section-dark em { color: #8fc4e4; }
.section-dark .ref { color: #e8975a; }
.platform-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 32px clamp(40px, 6vw, 80px); }
.platform-grid .section-head { margin-bottom: 0; }
.section-drawing { grid-row: span 2; color: var(--dark-ink); }
.section-drawing svg { width: 100%; height: auto; }
.section-drawing figcaption { margin-top: 10px; color: var(--dark-muted); font: italic 15px var(--serif); }
.ground path { stroke: currentColor; stroke-width: 2; }
.rack-outline rect { fill: none; stroke: currentColor; stroke-width: 1.6; }
.rack-outline > rect:first-child { stroke-width: 2.4; }
.rack-outline .hot { fill: rgb(232 151 90 / 22%); stroke: #e8975a; stroke-width: 2.4; }
.leds circle { fill: #8cb874; }
.leaders path { fill: none; stroke: currentColor; stroke-opacity: .6; stroke-width: 1.2; stroke-dasharray: 4 3; }
.leaders .hot-line { stroke: #e8975a; stroke-opacity: 1; stroke-dasharray: none; stroke-width: 1.6; }
.labels text { fill: currentColor; font: 600 12px var(--mono); letter-spacing: .08em; }
.labels .sub { fill: var(--dark-muted); font: italic 13px var(--serif); letter-spacing: 0; }
.labels .hot-text { fill: #e8975a; }
@media (prefers-reduced-motion: no-preference) { .leds circle { animation: blink 2.6s steps(2, end) infinite; } .leds circle:nth-child(3n) { animation-duration: 3.4s; } }
@keyframes blink { 50% { opacity: .35; } }
.key { display: grid; gap: 0; border-top: 1px solid rgb(242 234 216 / 20%); }
.key li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid rgb(242 234 216 / 20%); }
.key b { display: grid; width: 32px; height: 32px; place-items: center; border: 2px solid var(--dark-ink); border-radius: 50%; font: 700 13px var(--mono); }
.key h3 { font-size: 22px; }
.key p { margin-top: 4px; color: var(--dark-muted); font-size: 15px; }

/* Hosting plot */
.hosting-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: clamp(40px, 6vw, 80px); }
.hosting-grid .section-head { margin-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.chips li { padding: 7px 14px; border: 1.5px solid var(--rule); border-radius: 999px; font-size: 14px; font-weight: 550; }
.plot { position: relative; padding: 40px 32px 30px; border: 2px dashed var(--ink); background: repeating-linear-gradient(135deg, transparent 0 14px, var(--grid) 14px 15px), var(--card); }
.plot-label { position: absolute; top: -14px; left: 22px; display: flex; gap: 8px; }
.plot-label span { padding: 4px 10px; background: var(--ink); color: var(--paper); font: 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.plot-label span + span { background: var(--contour); color: #fff; }
.plot .btn { margin-top: 26px; }
.note { margin-top: 14px; color: var(--muted); font-size: 14px; }
.route { margin-top: 20px; counter-reset: route; }
.route li { position: relative; display: grid; gap: 2px; padding: 0 0 22px 46px; counter-increment: route; }
.route li::before { position: absolute; top: 0; left: 0; display: grid; width: 30px; height: 30px; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); content: counter(route); font: 700 13px var(--mono); }
.route li:not(:last-child)::after { position: absolute; top: 32px; bottom: 2px; left: 14px; border-left: 2px dashed var(--dash); content: ""; }
.route span { color: var(--muted); font-size: 15px; }

/* Weather station */
.status-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: center; gap: clamp(40px, 6vw, 80px); }
.status-grid .section-head { margin-bottom: 0; }
.station { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 30px; border: 2px solid var(--ink); background: var(--card); box-shadow: 8px 8px 0 var(--rule); }
.dial { display: grid; gap: 6px; padding-bottom: 18px; border-bottom: 1px dashed var(--dash); }
.reading { font: 600 clamp(52px, 6vw, 76px)/1 var(--serif); font-variant-numeric: tabular-nums; }
.reading small { margin-left: .1em; font-size: .4em; }
.unit { color: var(--muted); font: 13px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.gauge { grid-column: 1 / -1; }
.bars { display: flex; height: 70px; align-items: flex-end; gap: 3px; padding-bottom: 2px; border-bottom: 2px solid var(--ink); }
.bars i { flex: 1; height: 100%; background: linear-gradient(to top, var(--water) var(--up, 100%), var(--contour) var(--up, 100%)); opacity: .85; }
.axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font: 12px var(--mono); }
.station .note { grid-column: 1 / -1; margin-top: 0; }

/* Signposts */
.signposts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.signpost { position: relative; display: block; padding: 26px; border: 2px solid var(--ink); background: var(--card); transition: transform 140ms ease, box-shadow 140ms ease; }
.signpost:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.signpost::before { position: absolute; top: -2px; left: 26px; width: 40px; height: 6px; background: var(--wood); content: ""; }
.dist { color: var(--contour); font: 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.signpost h3 { margin-top: 10px; }
.signpost p { margin-top: 8px; color: var(--ink-2); font-size: 15px; }

/* Destination */
.destination { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: center; gap: clamp(32px, 6vw, 80px); padding: clamp(32px, 6vw, 64px); border: 2px solid var(--ink); background: var(--water); color: #f6f1e4; box-shadow: 10px 10px 0 var(--ink); }
.destination .ref { color: #ffd9b8; }
.destination em { color: #ffe08a; }
.destination p:not(.ref) { max-width: 30em; margin-top: 18px; font: 19px/1.5 var(--serif); }
.destination .btn { border-color: #f6f1e4; }
.destination .btn-ink { background: #f6f1e4; color: #1f3e52; }
.destination .btn-line { color: #f6f1e4; }
.destination .btn:hover { box-shadow: 3px 3px 0 #f6f1e4; }
.route-plain li::before { border-color: #f6f1e4; background: transparent; color: #f6f1e4; }
.route-plain li:not(:last-child)::after { border-color: rgb(246 241 228 / 45%); }
.route-plain span { color: rgb(246 241 228 / 80%); }
.route-plain strong { font-weight: 650; }

/* Footer */
.sheet-foot { padding: 40px 0 48px; border-top: 2px solid var(--ink); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px 48px; }
.imprint p { max-width: 30em; margin-top: 12px; color: var(--muted); font: italic 16px var(--serif); }
.sheet-foot nav { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 0 22px; }
.sheet-foot nav a { padding-block: 8px; font: 13px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.sheet-foot nav a:hover { color: var(--contour); }
.sheet-info { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 28px; padding-top: 18px; border-top: 1px dashed var(--dash); color: var(--muted); font: 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; }

/* Arrivals (JS adds .reveal only when motion is allowed) */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 600ms ease, transform 600ms cubic-bezier(.2, .7, .2, 1); }
.reveal.is-in { opacity: 1; transform: none; }

/* Tablet */
@media (max-width: 1000px) {
  .hero-grid, .platform-grid, .hosting-grid, .status-grid, .destination { grid-template-columns: 1fr; }
  .legend { max-width: 520px; }
  .section-drawing { grid-row: auto; }
  .grid-ref { display: none; }
}

/* Phone */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .menu-toggle { display: grid; width: 44px; height: 44px; margin-left: auto; place-content: center; gap: 6px; padding: 0; border: 2px solid var(--ink); border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; }
  .menu-toggle i { display: block; width: 16px; height: 2px; background: currentColor; transition: transform 200ms ease; }
  .menu-toggle[aria-expanded="true"] i:first-of-type { transform: translateY(4px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] i:last-of-type { transform: translateY(-4px) rotate(-45deg); }
  .site-nav { position: absolute; top: 64px; right: 0; left: 0; display: none; flex-direction: column; gap: 0; padding: 6px var(--gutter) 18px; border-bottom: 2px solid var(--ink); background: var(--paper); }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 15px 2px; border-bottom: 1px dashed var(--dash); font-size: 15px; }
  .nav-project { margin: 14px 0 0; padding: 14px !important; border: 2px solid var(--ink) !important; text-align: center; }
  .hero { min-height: 0; }
  .hero-grid { padding-bottom: 96px; }
  .lead { font-size: 19px; }
  .poi-grid, .signposts { grid-template-columns: 1fr; }
  .poi-card { padding: 22px; }
  .station { grid-template-columns: 1fr 1fr; padding: 22px; }
  .reading { font-size: 48px; }
  .foot-grid { grid-template-columns: 1fr; }
}
