/* The Ranch STEAM Lab — Solar Field */

:root {
  --sky: #CDE8FA;
  --sky-line: #A7D2F2;
  --ground: #EEF6FC;
  --ink: #0B1E3F;
  --ink-soft: #2C4468;
  --navy: #0E2A5C;
  --cell: #1F4E9C;
  --monitor: #0B1E3F;
  --monitor-ink: #E6F2FC;
  --monitor-soft: #9DB9DC;
  --sun: #FFC93C;
  --sun-halo: #FDE7A6;
  --field: #7F9C8A;
  --trees: #3B6066;
  --focus: #0E2A5C;

  --font-display: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1320px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: clamp(4.5rem, 9vw, 8rem);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky: #0F2448;
    --sky-line: #1C3A6A;
    --ground: #0A1A36;
    --ink: #E6F2FC;
    --ink-soft: #A9C3E3;
    --navy: #E6F2FC;
    --monitor: #061127;
    --monitor-ink: #E6F2FC;
    --monitor-soft: #8FAAD0;
    --sun-halo: #2A4675;
    --field: #1E302F;
    --trees: #0B1A26;
    --focus: #FFC93C;
    color-scheme: dark;
  }
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, canvas { display: block; max-width: 100%; }

::selection { background: var(--sun); color: #0B1E3F; }

a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

html { scrollbar-color: var(--cell) var(--ground); }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  background: var(--sun); color: #0B1E3F; padding: 0.6rem 1rem; font-weight: 600;
}
.skip:focus { top: 1rem; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 100svh;
  background: var(--sky);
  overflow: hidden;
  isolation: isolate;
}

.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding-block: clamp(1rem, 2.4vw, 1.75rem);
  position: relative; z-index: 2;
}

.brand { display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none; font-weight: 600; }
.brand-mark { width: 56px; height: auto; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.125rem; letter-spacing: -0.01em; }

.nav { display: flex; gap: clamp(1rem, 3vw, 2.25rem); list-style: none; margin: 0; padding: 0; font-weight: 500; }
.nav a { text-decoration: none; padding-block: 0.4rem; }
.nav a:hover { text-decoration: underline; }

@media (prefers-color-scheme: dark) {
  .brand-mark { content: url("assets/rsl-mark-light.svg"); }
}

.sky {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: var(--space-4);
  padding-block: clamp(1.5rem, 5vh, 3.5rem) clamp(1.5rem, 4vh, 3rem);
}

.sun {
  position: absolute; z-index: -1;
  width: clamp(56px, 7vw, 104px); aspect-ratio: 1; border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 clamp(10px, 1.4vw, 18px) var(--sun-halo);
  left: 0; top: 0;
  transform: translate(var(--sun-x, 82vw), var(--sun-y, 0px));
  will-change: transform;
}

.headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, min(6.4vw, 8.5svh), 5.75rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--navy);
}
.headline span { display: block; }

.intro { max-width: 46ch; margin: clamp(1rem, 2.4svh, 1.75rem) 0 clamp(1.25rem, 3svh, 2rem); font-size: clamp(1.0625rem, 1.3vw, 1.25rem); color: var(--ink-soft); }

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

.button {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 48px; padding: 0.8rem 1.4rem;
  background: var(--monitor); color: var(--monitor-ink);
  font-weight: 600; text-decoration: none;
  transition: background-color 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.button::after {
  content: ""; width: 0.55em; height: 0.55em;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  transform: rotate(45deg); margin-left: 0.1rem;
}
.button[href^="#"]::after { transform: rotate(135deg); margin-top: -0.25em; }
.button:hover { background: var(--cell); text-decoration: none; }
.button:active { transform: translateY(1px); }
@media (prefers-color-scheme: dark) {
  .button { background: #2E64C2; color: #FFFFFF; }
  .button:hover { background: #3D74D4; }
}

/* Dark bands carry their own focus colour so the ring stays visible */
.monitor, .footer { --focus: var(--monitor-ink); }
.product { --focus: var(--p-ink); }

/* Field: the canvas array */

.field {
  position: relative;
  min-height: clamp(220px, 32svh, 420px);
  /* the grass shows between panel rows; the sky continues behind the treeline */
  background: linear-gradient(var(--sky) 0 6%, var(--field) 6%);
}
.array { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Monitor strip */

.monitor { background: var(--monitor); color: var(--monitor-ink); position: relative; z-index: 2; }
.monitor-list {
  list-style: none; margin-block: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
}
.reading {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "lamp name" ". status" ". link";
  column-gap: 0.75rem; row-gap: 0.15rem;
  align-content: start;
  padding: 1.1rem clamp(0.75rem, 2vw, 1.75rem) 1.25rem;
  border-left: 1px solid rgba(157, 185, 220, 0.25);
}
.reading:first-child { border-left: 0; padding-left: 0; }
.reading .lamp { grid-area: lamp; align-self: center; }
.reading-name { grid-area: name; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; }
.reading-status { grid-area: status; color: var(--monitor-soft); font-size: 0.95rem; }
.reading-link { grid-area: link; justify-self: start; font-weight: 600; color: var(--monitor-ink); text-decoration-color: var(--monitor-soft); margin-top: 0.35rem; min-height: 24px; }
.reading-link:hover { text-decoration-color: currentColor; }

/* Status lamps: shape carries the state, colour only supports it */
.lamp { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
[data-state="live"] .lamp { background: var(--sun); box-shadow: 0 0 0 4px rgba(255, 201, 60, 0.22); }
/* The live lamp reads like an inverter that is generating */
@media (prefers-reduced-motion: no-preference) {
  .monitor [data-state="live"] .lamp { animation: generating 2.4s var(--ease-out) infinite; }
}
@keyframes generating {
  0% { box-shadow: 0 0 0 0 rgba(255, 201, 60, 0.5); }
  70%, 100% { box-shadow: 0 0 0 10px rgba(255, 201, 60, 0); }
}
[data-state="wait"] .lamp { background: conic-gradient(currentColor 0 50%, transparent 0); border: 2px solid currentColor; }
[data-state="dev"] .lamp { border: 2px dashed currentColor; }

@media (max-width: 860px) {
  .sky { grid-template-columns: 1fr; gap: var(--space-3); }
  .monitor-list { grid-template-columns: 1fr; }
  .reading { border-left: 0; border-top: 1px solid rgba(157, 185, 220, 0.25); padding-inline: 0; padding-block: 0.9rem; }
  .reading:first-child { border-top: 0; }
  .reading { grid-template-areas: "lamp name link" ". status status"; grid-template-columns: auto 1fr auto; }
  .reading-link { margin-top: 0; align-self: center; }
}

@media (max-width: 560px) {
  .brand-name { font-size: 1rem; }
  .brand-mark { width: 44px; }
  .nav { gap: 0.9rem; font-size: 0.95rem; }
  .field { min-height: 34svh; }
}
@media (max-width: 400px) {
  .brand-name { display: none; }
}

/* ---------- Sections ---------- */

.section-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2rem, 4.2vw, 3.5rem); line-height: 1; letter-spacing: -0.03em;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

.products { position: relative; }

.product { background: var(--p-bg); color: var(--p-ink); }
.product-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: center; gap: clamp(2rem, 6vw, 6rem);
  padding-block: clamp(3rem, 7vw, 6rem);
}
.product-flip .product-copy { order: 2; }
.product-name {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.5rem, 6vw, 5rem); line-height: 0.95; letter-spacing: -0.035em;
  margin: 0 0 var(--space-3);
}
.product-pitch { font-size: clamp(1.125rem, 1.6vw, 1.375rem); max-width: 30ch; margin: 0 0 var(--space-3); color: var(--p-ink); }
.product-status { display: flex; align-items: center; gap: 0.6rem; color: var(--p-soft); margin: 0 0 var(--space-4); font-weight: 500; }
.product-status .lamp { color: var(--p-accent); }
.product-status[data-state="live"] .lamp { background: var(--p-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--p-accent) 25%, transparent); }
.product-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: 0; }
/* Every action button wears the lab's blue, whatever band it sits on */
.button-product { background: #8EC1FF; color: #0B1E3F; }
.button-product:hover { background: #B9D9FF; }
.text-link { color: var(--p-ink); font-weight: 600; min-height: 24px; }

.product-media { margin: 0; perspective: 1000px; }

/* Each image is a solar panel: an aluminium frame with a glint of sun
   travelling around it, tilting toward the cursor like a tracker. */
@property --glint {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.panel {
  --frame: 8px;
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 30%;
  position: relative;
  display: block;
  padding: var(--frame);
  background: color-mix(in srgb, var(--p-bg) 70%, #000);
  box-shadow:
    inset 0 0 0 1px rgba(188, 211, 240, 0.28),
    0 2px 0 rgba(255, 255, 255, 0.05),
    0 28px 56px -18px rgba(3, 10, 28, 0.7);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 600ms var(--ease-out), box-shadow 600ms var(--ease-out);
}
.panel img { width: 100%; height: auto; position: relative; }

/* the travelling glint, drawn only in the frame ring */
.panel::before {
  content: "";
  position: absolute; inset: 0;
  padding: var(--frame);
  border-radius: inherit;
  background: conic-gradient(
    from var(--glint),
    transparent 0deg 250deg,
    rgba(142, 193, 255, 0.55) 300deg,
    #FFFFFF 330deg,
    rgba(255, 201, 60, 0.9) 338deg,
    rgba(142, 193, 255, 0.4) 350deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: glint-orbit 7s linear infinite;
  filter: drop-shadow(0 0 6px rgba(142, 193, 255, 0.9)) drop-shadow(0 0 14px rgba(230, 242, 252, 0.45));
  pointer-events: none;
}
.product:nth-child(3) .panel::before { animation-delay: -2.3s; }
.product:nth-child(4) .panel::before { animation-delay: -4.6s; }
@keyframes glint-orbit { to { --glint: 360deg; } }

/* sunlight sheen that follows the cursor across the glass */
.panel-sheen {
  position: absolute; inset: var(--frame);
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(230, 242, 252, 0.35), rgba(230, 242, 252, 0) 45%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
  pointer-events: none;
}
.panel.is-tracking { box-shadow: inset 0 0 0 1px rgba(188, 211, 240, 0.45), 0 2px 0 rgba(255, 255, 255, 0.05), 0 40px 70px -20px rgba(3, 10, 28, 0.8); transition: transform 120ms linear, box-shadow 400ms var(--ease-out); }
.panel.is-tracking .panel-sheen { opacity: 1; }

#ripple-pool .panel { max-width: 540px; margin-inline: auto; border-radius: 50%; }
#ripple-pool .panel img { border-radius: 50%; }

@media (prefers-reduced-motion: reduce) {
  .panel::before { animation: none; --glint: 140deg; }
  .panel { transform: none; }
}

@media (max-width: 860px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-flip .product-copy { order: 0; }
  .product-media { order: -1; }
}

/* Reveal: content is visible by default; only scripted pages hide it first */
.js .product-media { clip-path: inset(-80px -80px -80px -80px); transition: clip-path 900ms var(--ease-out), transform 900ms var(--ease-out); }
.js .product:not(.is-in) .product-media { clip-path: inset(0 0 100% 0); transform: translateY(24px); }
@media (prefers-reduced-motion: reduce) {
  .js .product:not(.is-in) .product-media { clip-path: none; transform: none; }
}

.about { padding-block: var(--space-6); background: var(--sky); }
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3) clamp(2rem, 6vw, 6rem); }
.about-grid .section-title { grid-column: 1 / -1; max-width: 16ch; color: var(--navy); }
.about-copy p { margin: 0 0 var(--space-2); font-size: clamp(1.125rem, 1.5vw, 1.3125rem); max-width: 38ch; }
.facts { margin: 0; display: grid; gap: 0; align-self: start; border-top: 2px solid var(--navy); }
.facts div { display: grid; grid-template-columns: 9rem 1fr; gap: var(--space-2); padding-block: 0.9rem; border-bottom: 1px solid var(--sky-line); }
.facts dt { font-weight: 600; color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 500; }
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 7.5rem 1fr; }
}

.contact { padding-block: var(--space-6) var(--space-5); }
.contact .section-title { margin-bottom: var(--space-2); }
.contact-note { margin: 0 0 var(--space-3); font-size: 1.25rem; color: var(--ink-soft); max-width: 40ch; }
.contact-email {
  display: inline-block;
  font-weight: 600;
  font-size: clamp(1.125rem, 1.5vw, 1.3125rem); line-height: 1.4;
  color: var(--cell);
  text-decoration-thickness: 2px; text-underline-offset: 0.22em;
  overflow-wrap: anywhere;
}
.contact-email:hover { color: var(--navy); }
@media (prefers-color-scheme: dark) { .contact-email { color: #8EC1FF; } }

.footer { background: var(--monitor); color: var(--monitor-ink); }
.footer-row { display: flex; align-items: center; gap: var(--space-3); padding-block: var(--space-4); flex-wrap: wrap; }
.footer-row p { margin: 0; margin-right: auto; color: var(--monitor-soft); }
.footer-mark { width: 64px; height: auto; }
.footer a { font-weight: 600; min-height: 24px; display: inline-flex; align-items: center; }

/* ---------- Privacy page ---------- */

.doc-head { background: var(--sky); }
.doc-head .masthead { padding-block: 1.25rem; }
.doc { padding-block: var(--space-5) var(--space-6); }
.doc h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.25rem, 5vw, 3.75rem); letter-spacing: -0.03em; line-height: 1; margin: 0 0 var(--space-2); color: var(--navy); }
.doc .updated { color: var(--ink-soft); margin: 0 0 var(--space-4); }
.doc h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; margin: var(--space-4) 0 var(--space-1); letter-spacing: -0.01em; }
.doc p, .doc li { max-width: 68ch; }
.doc ul { padding-left: 1.2rem; }
