/* ==========================================================================
   ROB.TF — Rob Whyte, personal index
   Concept: “the console”, stripped bare. Five things on one screen, centred,
   no scroll: the thesis, a live MEL⇄EDI ping, two project links, a contact
   line, an ABN. Everything else is gone. The headline and the ping are the
   stars; the rest is quiet support.
   CoreHost family skin:
     bg       #0E0F13  page ground (dark charcoal)
     surface  #15171C  the form / link chrome
     line     #232730  hairline rules
     text     #EDEEF3  primary
     muted    #A6ABB8  secondary
   Accents:
     blue        #1961EF  CoreHost blue (fills)
     blue-bright #4D8DFF  blue for text on dark — AA
     lime        #C9E215  micro-accent only (brand dot, ping)
   Type: Lato 300 / 400 / 700 / 900 throughout.

   Vertical fit: type, gaps and padding carry a vh term so the page settles
   into a 640px-tall viewport and relaxes on a 4K panel. Below 46rem width it
   unlocks into an ordinary scrolling column for phones.
   ========================================================================== */

:root {
  --bg: #0E0F13;
  --surface: #15171C;
  --line: #232730;
  --line-strong: #2E333D;
  --text: #EDEEF3;
  --muted: #A6ABB8;

  --blue: #1961EF;
  --blue-bright: #4D8DFF;
  --lime: #C9E215;

  --font-sans: "Lato", "Helvetica Neue", Arial, system-ui, sans-serif;

  --frame-max: 52rem;
  --frame-pad: clamp(1.25rem, 4vw, 2.5rem);

  /* the page’s vertical rhythm — scales with viewport height */
  --gap-y: clamp(0.9rem, 2.9vh, 3rem);
}

/* ---------- Reset & base ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

/* graticule — faint latitude hairlines behind everything, fading south-west */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(46, 51, 61, 0.5) 0 1px,
    transparent 1px 64px
  );
  -webkit-mask-image: radial-gradient(120% 105% at 85% -10%, #000 30%, transparent 75%);
  mask-image: radial-gradient(120% 105% at 85% -10%, #000 30%, transparent 75%);
  pointer-events: none;
}

/* a breath of CoreHost blue in the north-east corner */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(55% 45% at 88% 0%, rgba(25, 97, 239, 0.10), transparent 70%);
  pointer-events: none;
}

header, main, footer { position: relative; z-index: 1; }

h1, h2, p, ul, ol, figure { margin: 0; }
a { color: inherit; }
svg { display: block; }

::selection { background: var(--blue); color: #fff; }

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

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

.skip-link {
  position: absolute;
  left: 1rem; top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-radius: 6px;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; }

.frame {
  width: 100%;
  max-width: var(--frame-max);
  margin-inline: auto;
  padding-inline: var(--frame-pad);
}

/* ---------- Header ---------- */

.top { border-bottom: 1px solid var(--line); }

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: clamp(2.5rem, 5.5vh, 4rem);
}

.brand {
  font-size: 0.9375rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fff;
  text-decoration: none;
}
.brand .dot { color: var(--lime); }

.clocks {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Main: one screen, centred ---------- */

main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(0.75rem, 2vh, 2rem);
  min-width: 0;
}
main > * { flex-shrink: 0; }

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--gap-y);
  width: 100%;
}

/* ---------- Headline — the centrepiece ---------- */

h1 {
  font-weight: 900;
  font-size: clamp(2rem, 3vh + 1.5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: #fff;
  text-wrap: balance;
}

/* the joke: “invisible” is set as a ghost — outline only */
h1 em {
  font-style: normal;
  color: var(--blue-bright);
}
@supports (-webkit-text-stroke: 1px black) {
  h1 em {
    color: transparent;
    -webkit-text-stroke: 1.4px var(--text);
  }
}
@media (min-width: 46rem) {
  @supports (-webkit-text-stroke: 1px black) {
    h1 em { -webkit-text-stroke-width: 1.8px; }
  }
}

/* ---------- Route figure — the live ping ---------- */

.route {
  width: 100%;
  max-width: 40rem;
}

.route-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.route-pt {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.route-pt b {
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: var(--text);
}
.route-pt.is-edi { flex-direction: row-reverse; }

.route-stage { position: relative; }

.route-svg {
  width: 100%;
  height: auto;
}

.route-path {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.5;
}

.route-ring {
  fill: var(--bg);
  stroke: var(--line-strong);
  stroke-width: 1.5;
}
.route-core { fill: var(--text); }

.route-pulse--out circle { fill: var(--lime); }
.route-pulse--back circle { fill: var(--blue-bright); }

/* live latency readout, hung at the sag of the line */
.ping-readout {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, -100%);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.ping-ms {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  text-align: right;
}
.ping-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lime);
}

/* draw the line in on arrival; the ping breathes while the page is open */
@media (prefers-reduced-motion: no-preference) {
  .route-path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: route-draw 1.3s 0.4s cubic-bezier(0.65, 0, 0.25, 1) forwards;
  }
  .ping-dot { animation: ping-breathe 2.6s ease-in-out infinite; }
}
@media (prefers-reduced-motion: reduce) {
  .route-pulse { display: none; }
}
@keyframes route-draw { to { stroke-dashoffset: 0; } }
@keyframes ping-breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ---------- Project links — logo + name + one-liner ---------- */

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 40rem;
}

.link {
  flex: 1 1 17rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: clamp(0.6rem, 1.5vh, 0.85rem) clamp(0.85rem, 2vw, 1.1rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  text-align: left;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.link:hover,
.link:focus-visible {
  border-color: var(--blue);
  background: #181B21;
  transform: translateY(-1px);
}

/* logo mark sits in a fixed optical box so the two brands hang level */
.link-mark {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
}
.mark-corehost { width: auto; height: 1.75rem; }
.mark-scotlan  { width: 1.9rem; height: auto; }

.link-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1 1 auto;
}

.link-name {
  font-weight: 900;
  font-size: 0.95rem;
  line-height: 1.1;
  letter-spacing: -0.005em;
  color: #fff;
}

.link-desc {
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.005em;
  color: var(--muted);
  text-wrap: pretty;
  transition: color 0.2s ease;
}
.link:hover .link-desc,
.link:focus-visible .link-desc { color: var(--text); }

.link-arrow {
  flex: none;
  align-self: flex-start;
  margin-top: 0.1rem;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}
.link:hover .link-arrow,
.link:focus-visible .link-arrow {
  transform: translate(2px, -2px);
  color: var(--blue-bright);
}

/* ---------- Contact — one quiet instrument panel ---------- */

.contact { width: 100%; max-width: 40rem; }

.contact-form {
  display: grid;
  gap: clamp(0.7rem, 1.8vh, 1rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(1rem, 2.6vh, 1.6rem) clamp(1rem, 2vw, 1.5rem);
  text-align: left;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
.field-msg { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact-form label {
  display: block;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.contact-form input {
  width: 100%;
  padding: clamp(0.45rem, 1.2vh, 0.65rem) 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.45;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.contact-form input:hover { border-color: var(--line-strong); }

.contact-form input:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

/* Honeypot — visually removed, still in the accessibility-hidden DOM */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.btn-send {
  padding: clamp(0.5rem, 1.3vh, 0.7rem) 1.4rem;
  background: var(--blue);
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.18s ease, box-shadow 0.18s ease;
}
.btn-send:hover {
  filter: brightness(1.15);
  box-shadow: 0 10px 24px -14px rgba(25, 97, 239, 0.7);
}
.btn-send:disabled { opacity: 0.6; cursor: wait; filter: none; }

.form-status {
  font-size: 0.85rem;
  line-height: 1.45;
}
.form-status:empty { display: none; }
.form-status.is-error { color: #FF8A76; }

/* success state renders inside the form card — no double chrome */
.form-success { padding: 0.25rem 0.1rem; }
.form-kicker {
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--blue-bright);
  margin-bottom: 0.5rem;
}
.form-success p:last-child { color: var(--muted); font-size: 0.9375rem; }

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

.foot { border-top: 1px solid var(--line); }

.foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1.5rem;
  padding-block: clamp(0.5rem, 1.2vh, 1rem);
}

.fine {
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(12px);
    animation: rise 0.65s cubic-bezier(0.22, 0.61, 0.24, 1) forwards;
  }
  .r1 { animation-delay: 0.06s; }
  .r2 { animation-delay: 0.18s; }
  .r3 { animation-delay: 0.3s; }
  .r4 { animation-delay: 0.4s; }

  /* the brand dot blinks, occasionally — a heartbeat, not a siren */
  .brand .dot { animation: blip 5s ease-in-out infinite; }
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

@keyframes blip {
  0%, 86%, 100% { opacity: 1; }
  93% { opacity: 0.3; }
}

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

/* ==========================================================================
   Narrow screens — unlock into an ordinary scrolling column.
   The one-screen contract only applies where there’s a screen to fit.
   ========================================================================== */

@media (max-width: 46rem) {
  body { display: block; }

  main {
    padding-block: clamp(2rem, 9vw, 3.5rem);
  }

  .stage { gap: clamp(2rem, 8vw, 3rem); }

  h1 { font-size: clamp(2rem, 8vw, 2.75rem); }

  .field-row { grid-template-columns: 1fr; gap: 0.9rem; }

  .ping-readout { padding: 0.24rem 0.6rem; }

  .foot-row { padding-block: 0.9rem; }
}
