/* PLATO42 studio site
   Concept: the page starts in Plato's cave (ink, firelight) and walks out
   into daylight (stone). The palette is the hero's own materials: the dark
   of the cave wall, white marble, and the colour of the fire. One typeface,
   Jost. */

/* ============================================
   1. TOKENS
   ============================================ */

:root {
  --ink: #0b0a09;
  --ink-raised: #171513;
  --marble: #eeece8;
  --paper: #ffffff;
  --flame: #eeb480;
  --flame-bright: #f6d0aa;
  --day: #b9c4dc;

  --font: 'Jost', Futura, 'Century Gothic', 'Avenir Next', system-ui, sans-serif;

  --text-sm: 0.9375rem;
  --text-base: 1.125rem;
  --text-lg: clamp(1.1875rem, 0.6vw + 1.05rem, 1.4375rem);
  --text-h3: clamp(1.375rem, 0.8vw + 1.15rem, 1.75rem);
  --text-h2: clamp(2.125rem, 3.2vw + 1rem, 3.875rem);
  --text-h1: clamp(2.625rem, 4.6vw + 1rem, 5.5rem);

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section: clamp(4.5rem, 9vw, 8.5rem);
  --radius-panel: 1.5rem;
  --radius-field: 0.625rem;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Themes set local colors; components read them. */
.theme-ink {
  --bg: var(--ink);
  --fg: #f3f0ea;
  --muted: #a39f98;
  --line: rgba(243, 240, 234, 0.14);
  --focus: var(--flame);
  --btn-bg: var(--fg);
  --btn-fg: var(--ink);
  --btn-hover-bg: var(--flame);
  --btn-hover-fg: var(--ink);
  background: var(--bg);
  color: var(--fg);
  color-scheme: dark;
}

.theme-marble {
  --bg: var(--marble);
  --fg: var(--ink);
  --muted: #57534d;
  --line: rgba(11, 10, 9, 0.14);
  --focus: var(--ink);
  --btn-bg: var(--ink);
  --btn-fg: #ffffff;
  --btn-hover-bg: var(--flame);
  --btn-hover-fg: var(--ink);
  background: var(--bg);
  color: var(--fg);
  color-scheme: light;
}

/* ============================================
   2. BASE
   ============================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.55;
  background: var(--ink);
  color: #f3f0ea;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-weight: 400;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-h1);
  line-height: 1.02;
  letter-spacing: -0.028em;
}

h2 {
  font-size: var(--text-h2);
  line-height: 1.06;
  letter-spacing: -0.022em;
}

h3 {
  font-size: var(--text-h3);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p {
  max-width: 62ch;
  text-wrap: pretty;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus, var(--flame));
  outline-offset: 3px;
}

section[id],
article[id] {
  scroll-margin-top: 1.5rem;
}

.wrap {
  width: 100%;
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.lede {
  font-size: var(--text-lg);
  color: var(--muted);
  max-width: 46ch;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: 0 0 0.5rem 0.5rem;
  background: var(--flame);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   3. BUTTONS AND LINKS
   ============================================ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease;
}

.button:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-fg);
}

.button:active {
  transform: translateY(1px);
}

.button-compact {
  padding: 0.6rem 1.25rem;
  font-size: var(--text-sm);
}

.nowrap {
  white-space: nowrap;
}

.text-link {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
  transition: text-decoration-color 180ms ease;
}

.text-link:hover {
  text-decoration-color: currentColor;
}

.wordmark {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-decoration: none;
}

/* ============================================
   4. HEADER
   ============================================ */

.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 3;
  background: transparent;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.5rem;
}

.site-nav {
  display: flex;
  gap: clamp(1.25rem, 2.5vw, 2.5rem);
  margin-left: auto;
}

.site-nav a {
  color: var(--muted);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color 180ms ease;
}

.site-nav a:hover {
  color: var(--fg);
}

/* ============================================
   5. HERO
   ============================================ */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: min(100svh, 58rem);
  padding-block: 7rem 4rem;
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
}

/* The copy and the controls sit above the canvas, which is wider than its
   column. */
.hero-copy,
.form-controls {
  position: relative;
  z-index: 1;
}

.hero-sentence {
  display: block;
  animation: rise 0.9s var(--ease-out) both;
}

.hero-sentence + .hero-sentence {
  color: var(--muted);
  animation-delay: 0.12s;
}

.hero-lede {
  margin-top: 2rem;
  max-width: 40ch;
  font-size: var(--text-lg);
  color: var(--muted);
  animation: rise 0.9s var(--ease-out) 0.24s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2rem;
  margin-top: 2.5rem;
  animation: rise 0.9s var(--ease-out) 0.34s both;
}

.hero-form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

html:not(.js) .hero-form {
  display: none;
}

/* The stage takes the drag and holds the pair of numerals. The canvas also
   carries the light spilling around them, so it runs past the stage; its
   edges fade out before they can show. */
.form-stage {
  position: relative;
  width: 100%;
  max-width: 34rem;
  aspect-ratio: 5 / 4;
  cursor: pointer;
  touch-action: pan-y;
}

.form-stage.is-dragging {
  cursor: grabbing;
}

#form-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 148%;
  max-width: none;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease;
  -webkit-mask-image: radial-gradient(ellipse closest-side, #000 58%, rgba(0, 0, 0, 0.55) 80%, transparent 100%);
  mask-image: radial-gradient(ellipse closest-side, #000 58%, rgba(0, 0, 0, 0.55) 80%, transparent 100%);
}

#form-canvas.is-ready {
  opacity: 1;
}

.form-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  animation: fade 1.2s ease 0.8s both;
}

/* The turn control: a bead on a shallow arc, like the front rim of a
   turntable. The arc runs from the fire's colour to daylight's and the bead
   glows with whichever light it is nearer; nothing says what the turn shows.
   The real control is a transparent range input laid over the arc, so
   pointer, touch and keyboard all come for free. --t is 0 to 1, set by JS. */
.form-turn {
  --t: 0;
  --inset: 0.875rem;
  --rim: 0.75rem;
  --dip: 1.125rem;
  --glow: var(--flame);
  position: relative;
  /* The arc is exactly as wide as the marble 4 it sits under at the start
     (39% of the stage width at this canvas size), so the bead starts under
     the 4's left edge. */
  width: calc(min(100%, 34rem) * 0.39 + var(--inset) * 2);
  height: 2.75rem;
}

@supports (color: color-mix(in srgb, red, blue)) {
  .form-turn {
    --glow: color-mix(in srgb, var(--day) calc(var(--t) * 100%), var(--flame));
  }
}

.form-turn input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  opacity: 0;
  cursor: grab;
}

.form-turn input:active {
  cursor: grabbing;
}

/* The unseen native thumb is two insets wide, so it stays under the bead. */
.form-turn input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: calc(var(--inset) * 2);
  height: 2.75rem;
}

.form-turn input::-moz-range-thumb {
  width: calc(var(--inset) * 2);
  height: 2.75rem;
  border: 0;
}

.form-turn-track {
  position: absolute;
  top: var(--rim);
  left: var(--inset);
  width: calc(100% - var(--inset) * 2);
  height: var(--dip);
  overflow: visible;
  pointer-events: none;
}

/* Small end stops, drawn in the two lights' colours. The viewBox is
   stretched, so they are sized with a stroke that does not scale. */
.form-turn-end {
  stroke: currentColor;
  stroke-width: 5px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  r: 0.01px;
}

.form-turn-end:first-of-type {
  color: #eeb480;
}

.form-turn-end:last-of-type {
  color: #d3dcf0;
}

.form-turn-track path {
  fill: none;
  stroke: url(#form-turn-light);
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}

/* Same curve as the path: a parabola that is deepest in the middle. */
.form-turn-bead {
  position: absolute;
  top: calc(var(--rim) + var(--dip) * 4 * var(--t) * (1 - var(--t)));
  left: calc(var(--inset) + var(--t) * (100% - var(--inset) * 2));
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  background: var(--fg);
  /* a thin ring a few pixels out, then the glow */
  box-shadow: 0 0 0 0.25rem var(--ink), 0 0 0 0.3125rem var(--glow), 0 0 1.5rem 0.4rem var(--glow);
  transform: translate(-50%, -50%);
  transition: scale 180ms ease;
  pointer-events: none;
}

/* Until the first action the bead breathes, so the arc reads as a control. */
.form-turn:not(.is-used) .form-turn-bead {
  animation: bead-pulse 2.6s ease-in-out 2s infinite;
}

@keyframes bead-pulse {
  50% {
    box-shadow: 0 0 0 0.25rem var(--ink), 0 0 0 0.3125rem var(--glow), 0 0 0 0.75rem transparent, 0 0 2.25rem 0.7rem var(--glow);
    scale: 1.18;
  }
}

.form-turn input:hover ~ .form-turn-bead,
.form-turn input:active ~ .form-turn-bead {
  scale: 1.25;
}

.form-turn input:focus-visible {
  outline: 0;
}

.form-turn input:focus-visible ~ .form-turn-bead {
  outline: 2px solid var(--flame);
  outline-offset: 5px;
}

.form-caption {
  max-width: none;
  font-size: 1rem;
  color: #dedad2;
  text-align: center;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ============================================
   6. DISCIPLINES
   ============================================ */

.disciplines {
  padding-block: var(--section);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: end;
  gap: 1.5rem clamp(1.5rem, 4vw, 4rem);
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

.discipline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

/* Each card borrows its four rows (heading, intro, list, button) from the
   grid, so the two cards stay in line whatever their text lengths. */
.discipline {
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
  row-gap: 0;
  justify-items: start;
  padding: clamp(1.75rem, 3.6vw, 3.5rem);
  border-radius: var(--radius-panel);
}

.discipline-platforms {
  background: var(--paper);
}

.discipline h3 {
  font-size: clamp(1.875rem, 2.2vw + 1rem, 3rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.discipline > p {
  margin-top: 1.25rem;
  color: var(--muted);
}

.spec-list {
  width: 100%;
  margin-block: 2.5rem;
}

.spec-list > div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.25rem 1.5rem;
  padding-block: 1rem;
  border-top: 1px solid var(--line);
}

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

.spec-list dt {
  font-weight: 500;
}

.spec-list dd {
  color: var(--muted);
}

.discipline .button {
  align-self: end;
}

/* ============================================
   7. APPROACH
   ============================================ */

.approach {
  padding-bottom: var(--section);
}

.approach-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: start;
  gap: 2.5rem clamp(1.5rem, 4vw, 4rem);
}

.approach h2 span {
  display: block;
}

.approach h2 span + span {
  color: var(--muted);
}

.approach-point {
  padding-block: 1.5rem;
  border-top: 1px solid var(--line);
}

.approach-point:last-child {
  padding-bottom: 0;
}

.approach-point p {
  margin-top: 0.5rem;
  color: var(--muted);
}

/* ============================================
   8. PROCESS
   ============================================ */

.process {
  padding-bottom: var(--section);
}

.process-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2.5rem clamp(1.5rem, 3vw, 3rem);
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
  list-style: none;
  counter-reset: step;
}

.process-steps li {
  counter-increment: step;
  padding-top: 1.25rem;
  border-top: 1px solid var(--fg);
}

.process-steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 2.5rem;
  font-size: var(--text-h2);
  font-weight: 300;
  line-height: 1;
}

.process-steps p {
  margin-top: 0.5rem;
  color: var(--muted);
}

/* ============================================
   9. CONTACT
   ============================================ */

.contact {
  padding-block: var(--section);
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: start;
  gap: 3rem clamp(1.5rem, 5vw, 5rem);
}

.contact-intro .lede {
  margin-top: 1.5rem;
}

.contact-form {
  display: grid;
  gap: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: var(--text-sm);
  color: var(--muted);
  transition: color 180ms ease;
}

.form-group:focus-within label {
  color: var(--fg);
}

.optional {
  opacity: 0.85;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  background: var(--ink-raised);
  color: var(--fg);
  font: inherit;
  transition: border-color 180ms ease;
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23a39f98' stroke-width='1.5'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

.form-group select:invalid {
  color: var(--muted);
}

.form-group textarea {
  min-height: 8.5rem;
  resize: vertical;
}

.form-group ::placeholder {
  color: #8a867f;
  opacity: 1;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: rgba(243, 240, 234, 0.3);
}

.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
  outline: 2px solid var(--flame);
  outline-offset: 0;
  border-color: transparent;
}

.submit-button {
  justify-self: start;
  margin-top: 0.5rem;
}

.submit-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* ============================================
   10. FOOTER
   ============================================ */

.site-footer {
  padding-bottom: 2.5rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 1.5rem 2rem;
}

.footer-inner::before {
  content: '';
  grid-column: 1 / -1;
  margin-bottom: 1rem;
  border-top: 1px solid var(--line);
}

.footer-brand p,
.footer-legal,
.easter-egg-text {
  font-size: var(--text-sm);
  color: var(--muted);
}

.footer-brand p {
  margin-top: 0.25rem;
}

.footer-legal {
  justify-self: end;
}

.easter-egg-text {
  cursor: default;
  user-select: none;
  transition: color 400ms ease;
}

.easter-egg-text.is-lit {
  color: var(--flame);
}

/* ============================================
   11. RESPONSIVE
   ============================================ */

@media (max-width: 960px) {
  .process-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .discipline-grid,
  .section-head,
  .approach-grid,
  .contact-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Wide screens have room beside the column: a larger scene, moved a little
   right, with its left edge faded sooner so the light stays off the copy. */
@media (min-width: 1600px) {
  .hero-form {
    translate: 2.5rem 0;
  }

  #form-canvas {
    width: 170%;
    -webkit-mask-image: radial-gradient(ellipse closest-side, #000 58%, rgba(0, 0, 0, 0.55) 80%, transparent 100%), linear-gradient(to right, transparent 10%, #000 16.5%);
    -webkit-mask-composite: source-in;
    mask-image: radial-gradient(ellipse closest-side, #000 58%, rgba(0, 0, 0, 0.55) 80%, transparent 100%), linear-gradient(to right, transparent 10%, #000 16.5%);
    mask-composite: intersect;
  }

  .form-turn {
    width: calc(min(100%, 34rem) * 0.448 + var(--inset) * 2);
  }
}

/* Laptops: a smaller scene, so the pair and its light stay clear of the copy. */
@media (max-width: 1360px) {
  #form-canvas {
    width: 126%;
  }

  .form-turn {
    width: calc(min(100%, 34rem) * 0.332 + var(--inset) * 2);
  }
}

/* One column: the message first, the form below it. */
@media (max-width: 900px) {
  .hero {
    min-height: 0;
    padding-block: 6.5rem 3rem;
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 3.5rem;
  }

  .form-stage {
    max-width: min(24rem, 100%);
    aspect-ratio: 5 / 3;
  }

  #form-canvas {
    width: 132%;
  }

  .form-turn {
    width: calc(min(100%, 24rem) * 0.348 + var(--inset) * 2);
  }
}

@media (max-width: 768px) {
  .site-nav {
    display: none;
  }

  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }

  .footer-legal {
    justify-self: start;
  }
}

@media (max-width: 480px) {
  .form-row,
  .process-steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .spec-list > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .process-steps li::before {
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 360px) {
  .discipline .button {
    padding-inline: 1.25rem;
    font-size: 1rem;
  }
}

/* ============================================
   12. REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
