/* ============================================================
   raypreble.com — shared stylesheet
   Ground: warm paper. Accent: 532 nm, the laser line the ERE
   bench runs on. Type: Spectral (display) + IBM Plex Sans/Mono.
   Structure borrows from the engineering lab report — numbered
   sections, numbered figures, spec tables, display equations.
   ============================================================ */

:root{
  --paper:       #FBF9F4;
  --paper-sunk:  #F4F1E8;
  --ink:         #1A1917;
  --ink-soft:    #45413A;
  --ink-muted:   #7A7365;
  --rule:        #E4DED0;
  --rule-strong: #CFC7B4;
  --beam:        #157F3F;
  --beam-bright: #5CE65C;

  --font-display:"Spectral", ui-serif, Georgia, serif;
  --font-body:   "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:   "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --measure: 60rem;
  --gutter:  clamp(1.25rem, 4vw, 3.5rem);
}

*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; scroll-behavior:smooth; font-size:100%; }
@media (min-width:1400px){ html{ font-size:110%; } }
@media (min-width:1800px){ html{ font-size:118%; } }

body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--font-body);
  font-size:1rem;
  line-height:1.62;
  -webkit-font-smoothing:antialiased;
}

.wrap{ max-width:46rem; margin:0 auto; padding:0 var(--gutter); }
.wrap-wide{ max-width:64rem; margin:0 auto; padding:0 var(--gutter); }

a{ color:var(--beam); text-underline-offset:.2em; text-decoration-thickness:1px; }
a:hover{ text-decoration-thickness:2px; }
:focus-visible{ outline:2px solid var(--beam); outline-offset:3px; border-radius:2px; }

/* ---------- masthead ---------- */
.masthead{
  display:flex; align-items:baseline; justify-content:space-between;
  gap:1rem; flex-wrap:wrap; padding:1.5rem 0 1.25rem;
}
.wordmark{
  font-family:var(--font-mono); font-size:.78rem; font-weight:500;
  letter-spacing:.14em; text-transform:uppercase; color:var(--ink);
  text-decoration:none;
}
.wordmark:hover{ color:var(--beam); }
.masthead nav{
  font-family:var(--font-mono); font-size:.72rem;
  letter-spacing:.08em; text-transform:uppercase;
  display:flex; gap:1.25rem;
}
.masthead nav a{ color:var(--ink-muted); text-decoration:none; }
.masthead nav a:hover{ color:var(--beam); }

/* ---------- beam rule ---------- */
.beam{ position:relative; height:1px; background:var(--rule); border:0; margin:0; }
.beam::after{
  content:""; position:absolute; inset:-1px 0;
  background:linear-gradient(90deg,transparent 0%,rgba(92,230,92,0) 8%,
    rgba(92,230,92,.8) 38%,rgba(21,127,63,.95) 50%,rgba(92,230,92,.8) 62%,
    rgba(92,230,92,0) 92%,transparent 100%);
  transform:scaleX(0); transform-origin:0 50%;
  animation:align 1000ms cubic-bezier(.16,.84,.44,1) 200ms forwards;
}
@keyframes align{ 0%{transform:scaleX(0);opacity:1} 70%{transform:scaleX(1);opacity:1} 100%{transform:scaleX(1);opacity:.2} }

/* ---------- page head ---------- */
.pagehead{ padding:clamp(2.5rem,7vw,4.5rem) 0 clamp(1.5rem,4vw,2.5rem); }
.kicker{
  font-family:var(--font-mono); font-size:.72rem; font-weight:500;
  letter-spacing:.16em; text-transform:uppercase; color:var(--beam);
  margin:0 0 1rem;
}
.pagehead h1{
  font-family:var(--font-display); font-weight:400;
  font-size:clamp(1.9rem,1.2rem + 2.6vw,3rem); line-height:1.15;
  letter-spacing:-.015em; margin:0; max-width:20ch; text-wrap:balance;
}
.standfirst{
  margin:1.35rem 0 0; max-width:var(--measure);
  font-size:1.06rem; color:var(--ink-soft);
}

/* ---------- hero with portrait ---------- */
.hero{
  display:grid; align-items:start;
  gap:clamp(1.75rem,4vw,3rem); grid-template-columns:1fr;
}
.hero h1{ max-width:18ch; }
.portrait{ margin:0; max-width:15rem; }
.portrait img{
  display:block; width:100%; height:auto;
  border:1px solid var(--rule); border-radius:3px;
}
.portrait figcaption{ margin-top:.65rem; }
@media (min-width:48rem){
  .hero{ grid-template-columns:minmax(0,1fr) 16rem; }
  .portrait{ max-width:none; }
}

/* run-in spec strip under a page head */
.specstrip{
  display:flex; flex-wrap:wrap; gap:.4rem 2rem;
  margin-top:1.75rem; padding-top:1.1rem; border-top:1px solid var(--rule);
  font-family:var(--font-mono); font-size:.74rem; color:var(--ink-muted);
}
.specstrip b{ color:var(--ink); font-weight:500; }

/* ---------- sections ---------- */
.section{ padding:clamp(2.25rem,5vw,3.25rem) 0; }
.section > h2{
  font-family:var(--font-display); font-weight:600;
  font-size:clamp(1.3rem,1.1rem + .8vw,1.7rem);
  letter-spacing:-.01em; line-height:1.25;
  margin:0 0 1.25rem; padding-bottom:.65rem;
  border-bottom:1px solid var(--rule);
}
.section > h2 .num{
  font-family:var(--font-mono); font-size:.72em; font-weight:500;
  color:var(--beam); margin-right:.7em; letter-spacing:.04em;
}
.section h3{
  font-family:var(--font-mono); font-size:.76rem; font-weight:500;
  letter-spacing:.1em; text-transform:uppercase; color:var(--ink-muted);
  margin:2.25rem 0 .75rem;
}
.section p{ max-width:var(--measure); color:var(--ink-soft); margin:0 0 1.1rem; }
.section p.wide{ max-width:none; }
.section strong{ color:var(--ink); font-weight:600; }

/* ---------- figures (image slots) ----------
   Swap the .slot div for <img src="..." alt="..."> when the
   real image is ready; the frame and caption stay as-is. */
figure{ margin:2rem 0; }
/* lets a detailed screenshot escape the text measure so it stays legible */
.figure-wide{
  /* --fw is the image's own pixel width, set inline. Without it a small image
     gets stretched to the full breakout width and goes soft on large screens. */
  width:min(72rem, calc(100vw - 2 * var(--gutter)), var(--fw, 72rem));
  /* position/left rather than margin-left: a later `margin` shorthand on the
     element (e.g. .diagram) would otherwise silently reset the offset and
     leave the transform to shift it off-centre. */
  position:relative; left:50%; transform:translateX(-50%);
}
.figure-wide figcaption{ max-width:none; }
figure img{ display:block; width:100%; height:auto; border:1px solid var(--rule); border-radius:3px; }
.slot{
  display:flex; align-items:center; justify-content:center;
  min-height:clamp(11rem,26vw,17rem);
  border:1px dashed var(--rule-strong); border-radius:3px;
  background:
    repeating-linear-gradient(45deg,transparent,transparent 9px,rgba(207,199,180,.16) 9px,rgba(207,199,180,.16) 10px),
    var(--paper-sunk);
  font-family:var(--font-mono); font-size:.72rem; letter-spacing:.1em;
  text-transform:uppercase; color:var(--ink-muted); text-align:center;
  padding:1.5rem;
}
figcaption{
  font-family:var(--font-mono); font-size:.73rem; line-height:1.55;
  color:var(--ink-muted); margin-top:.7rem; max-width:var(--measure);
}
figcaption b{ color:var(--ink); font-weight:500; }

.m{ font-family:var(--font-mono); font-size:.92em; }

/* ---------- spec table ---------- */
.tablewrap{ overflow-x:auto; margin:1.75rem 0; }
table{ width:100%; border-collapse:collapse; font-size:.86rem; }
caption{
  caption-side:top; text-align:left;
  font-family:var(--font-mono); font-size:.73rem; color:var(--ink-muted);
  padding-bottom:.6rem;
}
caption b{ color:var(--ink); font-weight:500; }
th{
  font-family:var(--font-mono); font-size:.7rem; font-weight:500;
  letter-spacing:.09em; text-transform:uppercase; color:var(--ink-muted);
  text-align:left; padding:.5rem .9rem .5rem 0;
  border-bottom:1px solid var(--rule-strong); white-space:nowrap;
}
td{
  padding:.55rem .9rem .55rem 0; vertical-align:top;
  border-bottom:1px solid var(--rule); color:var(--ink-soft);
}
td:first-child{ color:var(--ink); }
td.m,th.m{ font-family:var(--font-mono); font-size:.8rem; }

/* ---------- equation ---------- */
.eq{
  margin:1.6rem 0; padding:1.15rem 1.25rem;
  background:var(--paper-sunk); border-left:2px solid var(--beam);
  border-radius:0 3px 3px 0;
  font-family:var(--font-display); font-size:1.05rem;
  overflow-x:auto;
}
.eq .note{
  display:block; margin-top:.6rem;
  font-family:var(--font-mono); font-size:.72rem; color:var(--ink-muted);
}

/* ---------- editorial note / callout ---------- */
.note-block{
  margin:2rem 0; padding:1.1rem 1.25rem; max-width:var(--measure);
  background:var(--paper-sunk); border-left:2px solid var(--rule-strong);
  border-radius:0 3px 3px 0;
}
.note-block .label{
  display:block; margin-bottom:.55rem;
  font-family:var(--font-mono); font-size:.7rem; font-weight:500;
  letter-spacing:.12em; text-transform:uppercase; color:var(--ink-muted);
}
.note-block p{ margin:0 0 .8rem; font-size:.92rem; }
.note-block p:last-child{ margin-bottom:0; }

/* ---------- code ---------- */
pre{
  margin:1.5rem 0; padding:1.1rem 1.2rem; overflow-x:auto;
  background:var(--paper-sunk); border:1px solid var(--rule);
  border-radius:3px; font-family:var(--font-mono);
  font-size:.79rem; line-height:1.6; color:var(--ink-soft);
}
code{ font-family:var(--font-mono); font-size:.88em; color:var(--ink); }
pre code{ font-size:1em; color:inherit; }

/* ---------- prose list, used sparingly ---------- */
.points{ list-style:none; margin:0 0 1.1rem; padding:0; max-width:var(--measure); }
.points li{ position:relative; padding-left:1.3rem; margin-bottom:.7rem; color:var(--ink-soft); }
.points li::before{
  content:""; position:absolute; left:.1rem; top:.72em;
  width:.5rem; height:1px; background:var(--beam); opacity:.75;
}

/* ---------- numbered procedure list ---------- */
.steps{ list-style:none; counter-reset:step; margin:0 0 1.1rem; padding:0; max-width:var(--measure); }
.steps li{ position:relative; padding-left:2.2rem; margin-bottom:.9rem; color:var(--ink-soft); }
.steps li::before{
  counter-increment:step; content:counter(step,decimal-leading-zero);
  position:absolute; left:0; top:.12em;
  font-family:var(--font-mono); font-size:.78rem; font-weight:500;
  letter-spacing:.04em; color:var(--beam);
}

/* ---------- project index cards ---------- */
.projects{ display:grid; gap:clamp(2.75rem,5vw,4.25rem); }
.card{ display:block; text-decoration:none; color:inherit; }
.card .slot{ min-height:clamp(13rem,26vw,20rem); transition:border-color 160ms ease; }
.card:hover .slot{ border-color:var(--beam); }
.card figure img{
  width:100%; height:clamp(13rem,26vw,20rem);
  object-fit:cover; object-position:center;
  transition:border-color 160ms ease;
}
.card:hover figure img{ border-color:var(--beam); }
.card-head{
  display:grid; grid-template-columns:1fr auto; gap:.2rem 1.5rem;
  align-items:baseline; margin-top:1rem;
}
.card h2{
  font-family:var(--font-display); font-weight:600;
  font-size:clamp(1.5rem,1.2rem + 1.1vw,2.1rem);
  letter-spacing:-.015em; margin:0; line-height:1.2;
}
.card:hover h2{ color:var(--beam); }
.card .when{
  grid-column:2; grid-row:1;
  font-family:var(--font-mono); font-size:.78rem;
  color:var(--ink-muted); white-space:nowrap;
}
.card p{ margin:.7rem 0 0; color:var(--ink-soft); font-size:1.03rem; }
.card .cardlink{
  display:inline-block; margin-top:1rem;
  font-family:var(--font-mono); font-size:.74rem; font-weight:500;
  letter-spacing:.08em; text-transform:uppercase; color:var(--beam);
}
.card:hover .cardlink{ text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:.3em; }
.card .tags{
  margin-top:.85rem; font-family:var(--font-mono); font-size:.72rem;
  letter-spacing:.05em; color:var(--ink-muted);
}

/* ---------- signal path diagram ---------- */
.diagram{ margin:2rem 0; }
.diagram svg{ display:block; width:100%; height:auto; }
.dg-box{ fill:var(--paper-sunk); stroke:var(--rule-strong); stroke-width:1; }
.dg-box-hi{ fill:var(--paper-sunk); stroke:var(--beam); stroke-width:1.4; }
.dg-t{ font-family:"IBM Plex Sans",sans-serif; font-size:11.5px; fill:var(--ink); }
.dg-s{ font-family:"IBM Plex Mono",monospace; font-size:9px; fill:var(--ink-muted); letter-spacing:.04em; }
.dg-line{ stroke:var(--rule-strong); stroke-width:1.2; fill:none; }
.dg-beamline{ stroke:var(--beam); stroke-width:1.6; fill:none; }
.dg-ref{ stroke:var(--beam); stroke-width:1.2; fill:none; stroke-dasharray:3 3; }

/* ---------- footer ---------- */
.footer{ padding:clamp(2.5rem,5vw,3.5rem) 0 4rem; }
.footer h2{
  font-family:var(--font-display); font-weight:400;
  font-size:clamp(1.35rem,1.15rem + 1vw,1.8rem);
  letter-spacing:-.012em; margin:0 0 1.1rem;
}
.contact{ display:flex; flex-wrap:wrap; gap:.5rem 2rem; margin-bottom:2rem; font-size:.97rem; }
.colophon{ font-family:var(--font-mono); font-size:.7rem; letter-spacing:.05em; color:var(--ink-muted); }

.btn{
  display:inline-block; padding:.65rem 1.15rem; border-radius:5px;
  font-size:.92rem; font-weight:500; text-decoration:none;
  border:1px solid var(--ink); background:var(--ink); color:var(--paper);
}
.btn:hover{ background:#000; }
.btn-quiet{ background:transparent; color:var(--ink); border-color:var(--rule-strong); }
.btn-quiet:hover{ border-color:var(--ink-muted); }
.actions{ display:flex; flex-wrap:wrap; gap:.7rem; margin-top:1.75rem; }

/* ---------- responsive + motion ---------- */
@media (max-width:34rem){
  .card-head{ grid-template-columns:1fr; }
  .card .when{ grid-column:1; grid-row:auto; }
  .masthead nav{ gap:1rem; }
}
@media (prefers-reduced-motion:reduce){
  html{ scroll-behavior:auto; }
  *,*::before,*::after{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
  .beam::after{ transform:scaleX(1); opacity:.2; }
}
