/* martinwillingham.co.uk
   Concept: a channel strip. Each role is a channel on a broadcast desk, with a
   level meter that settles once on load. No external fonts, scripts or trackers. */

:root {
  --paper: #e7eaee;
  --ink: #1f1233;
  --ink-soft: #4a3d63;
  --rule: rgba(31, 18, 51, 0.18);

  --panel: #1b1426;
  --panel-line: #3a3050;
  --panel-text: #eceaf2;

  --led-off: #2d2440;
  --led-green: #37d67a;
  --led-amber: #ffb020;
  --led-red: #ff453a;
  --on-air: #ff453a;

  /* Display: DIN-style signage on Windows, condensed grotesques elsewhere */
  --display: "Bahnschrift SemiBold Condensed", "Bahnschrift Condensed", "Avenir Next Condensed",
             "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", Charter, "Sitka Text", Georgia, "Times New Roman", serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #140e1f;
    --ink: #eceaf2;
    --ink-soft: #b9b0cc;
    --rule: rgba(236, 234, 242, 0.18);
    --panel: #221a32;
    --panel-line: #3d3157;
    --led-off: #342a4a;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.6;
}

/* ---------- Layout ---------- */

.page {
  flex: 1;
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 4vw, 3rem) 3rem;
  display: grid;
  align-content: center;
  gap: 3rem;
}

.intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  min-width: 0;
  container-type: inline-size; /* lets the name size itself to this column */
}

@media (min-width: 70rem) {
  .page {
    grid-template-columns: minmax(0, 1fr) minmax(0, 32rem);
    gap: 4rem;
    align-items: stretch;
  }
}

/* ---------- Type ---------- */

/* The name is sized from the width of its own column, with room to spare for
   the widest fallback font, so it can never run underneath the meter panel. */
h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.25rem, 11vw, 8rem);      /* older browsers */
  font-size: clamp(3.25rem, 17.5cqi, 9.5rem); /* sized to the column */
  line-height: 0.86;
  letter-spacing: -0.015em;
}

h1 span { display: block; }

h1.small {
  font-size: clamp(3rem, 10vw, 6rem);
  font-size: clamp(3rem, 16cqi, 6rem);
}

.bio {
  max-width: 32rem;
  margin: 0;
}

.nb { white-space: nowrap; }

/* ---------- Contact keys ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 2rem;
}

.key {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 3.25rem;
  padding: 0.6rem 1.5rem;
  border: 2px solid var(--ink);
  border-radius: 0.3rem;
  background: var(--ink);
  color: var(--paper);
  font: 700 1.4rem/1 var(--display);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.key--ghost {
  background: transparent;
  color: var(--ink);
}

.key:hover { background: transparent; color: var(--ink); }
.key--ghost:hover { background: var(--ink); color: var(--paper); }

.key--primary::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--on-air);
  box-shadow: 0 0 0 0.2rem rgba(255, 69, 58, 0.28);
}

a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- The desk: one channel per role ---------- */

.console {
  align-self: stretch;
  padding: 1.75rem 1rem 1.5rem;
  border-radius: 0.75rem;
  background: var(--panel);
  color: var(--panel-text);
}

.strips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.strip {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  padding: 0 0.5rem;
  border-left: 1px solid var(--panel-line);
}
.strip:first-child { border-left: 0; }

/* Levels (how much of the meter stays dark) and stagger order per channel */
.strip:nth-child(1) { --cut: 20%; --i: 0; }
.strip:nth-child(2) { --cut: 36%; --i: 1; }
.strip:nth-child(3) { --cut: 10%; --i: 2; }
.strip:nth-child(4) { --cut: 30%; --i: 3; }
.strip:nth-child(5) { --cut: 24%; --i: 4; }

.meter {
  position: relative;
  display: block;
  width: 1.5rem;
  height: clamp(13rem, 30vw, 20rem);
  margin: 0 auto;
  background: repeating-linear-gradient(to top, var(--led-off) 0 5px, transparent 5px 8px);
}

.lit {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    var(--led-green) 0 66%,
    var(--led-amber) 66% 86%,
    var(--led-red) 86% 100%);
  -webkit-mask-image: repeating-linear-gradient(to top, #000 0 5px, transparent 5px 8px);
          mask-image: repeating-linear-gradient(to top, #000 0 5px, transparent 5px 8px);
  clip-path: inset(var(--cut) 0 0 0);
  animation: rise 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i) * 140ms + 250ms);
}

.role {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
}

@keyframes rise {
  0%   { clip-path: inset(100% 0 0 0); }
  58%  { clip-path: inset(max(0%, calc(var(--cut) - 14%)) 0 0 0); }
  100% { clip-path: inset(var(--cut) 0 0 0); }
}

@keyframes rise-h {
  0%   { clip-path: inset(0 100% 0 0); }
  58%  { clip-path: inset(0 max(0%, calc(var(--cut) - 14%)) 0 0); }
  100% { clip-path: inset(0 var(--cut) 0 0); }
}

/* Phones: channels become rows, meters run left to right */
@media (max-width: 43.99rem) {
  .console { padding: 0.5rem 1.25rem; }

  .strips { grid-template-columns: 1fr; }

  .strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52%;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-left: 0;
    border-top: 1px solid var(--panel-line);
  }
  .strip:first-child { border-top: 0; }

  .role {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.4rem;
    text-align: left;
  }

  .meter {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 1.1rem;
    background: repeating-linear-gradient(to right, var(--led-off) 0 5px, transparent 5px 8px);
  }

  .lit {
    background: linear-gradient(to right,
      var(--led-green) 0 66%,
      var(--led-amber) 66% 86%,
      var(--led-red) 86% 100%);
    -webkit-mask-image: repeating-linear-gradient(to right, #000 0 5px, transparent 5px 8px);
            mask-image: repeating-linear-gradient(to right, #000 0 5px, transparent 5px 8px);
    clip-path: inset(0 var(--cut) 0 0);
    animation-name: rise-h;
  }
}

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

.foot {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 4vw, 3rem) 1.75rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  color: var(--ink-soft);
  font-size: 1rem;
}
.foot p { margin: 0; }
.foot a { color: var(--ink); text-underline-offset: 0.2em; }

/* ---------- Utilities ---------- */

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  z-index: 10;
}
.skip:focus { top: 1rem; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .lit { animation: none; }
  .key { transition: none; }
}

@media print {
  :root { --paper: #fff; --ink: #000; --ink-soft: #333; }
  .console, .skip { display: none; }
  .key { border: 0; padding: 0; background: none; color: #000; text-decoration: underline; }
  .key--primary::before { display: none; }
}
