/* ============================================================
   RMH DESIGNS — between the screen and the object
   Swiss substrate · avant-garde duality
   Rule: color exists only as light. Blue = screen. Matte = object.
   ============================================================ */

/* ---- Reset ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ---- Tokens --------------------------------------------------------- */
:root {
  /* color = light */
  --ink:      #17171B;   /* graphite — type & object linework           */
  --ink-2:    #34343B;   /* softened graphite                            */
  --paper:    #E6E5E0;   /* cool plaster — deliberately NOT warm cream   */
  --paper-2:  #DEDDD7;   /* recessed plaster                            */
  --concrete: #C9C7C0;   /* mid neutral — object surface & shadow        */
  --white:    #F2F1EC;   /* cool card white — luminous surface           */
  --signal:   #2338FF;   /* electric ultramarine — the screen's light    */
  --signal-2: #6E7BFF;   /* lifted signal for bloom                       */
  --hair:     rgba(23,23,27,0.16);
  --hair-2:   rgba(23,23,27,0.08);

  /* type */
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  --display: "Archivo", var(--sans);

  /* fluid scale */
  --fs-display: clamp(3rem, 13.5vw, 12.5rem);
  --fs-mega:    clamp(2.4rem, 9vw, 7rem);
  --fs-h2:      clamp(1.9rem, 5.2vw, 4rem);
  --fs-lead:    clamp(1.05rem, 1.7vw, 1.45rem);
  --fs-body:    1.0625rem;
  --fs-sm:      0.8125rem;
  --fs-mono:    0.72rem;

  /* rhythm — 8pt */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 40px;
  --s5: 64px; --s6: 96px; --s7: 128px;
  --gutter: clamp(20px, 4.5vw, 72px);
  --pad-y:  clamp(72px, 12vh, 176px);
  --maxw:   1440px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mast: 56px;
}

/* ---- Base ----------------------------------------------------------- */
html, body { background: var(--paper); }
body {
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv05";
}
/* faint plaster grain — material, not decoration */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mono { font-family: var(--mono); font-size: var(--fs-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.tnum { font-variant-numeric: tabular-nums; }

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

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; font-family: var(--mono); font-size: var(--fs-mono);
  transition: top .2s var(--ease);
}
.skip:focus { top: 12px; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* ============================================================
   MASTHEAD
   ============================================================ */
.masthead {
  position: fixed; inset: 0 0 auto 0; z-index: 90;
  height: var(--mast);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--hair-2);
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: var(--fs-mono); letter-spacing: 0.14em; text-transform: uppercase; }
.mark {
  width: 15px; height: 15px; flex: none;
  /* half matte graphite / half screen-blue — the duality in one glyph */
  background: linear-gradient(45deg, var(--ink) 0 50%, var(--signal) 50% 100%);
  transition: transform .55s var(--ease);
}
.brand:hover .mark { transform: rotate(180deg); }
.brand b { font-weight: 600; letter-spacing: 0.2em; }
.brand .reg { opacity: .5; }

.mast-center { justify-self: center; display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); }
.mast-center .swap { display: inline-block; animation: swap 6s var(--ease) infinite; }
@keyframes swap { 0%,44% { transform: none; } 50%,94% { transform: rotate(180deg); } }

.mast-right { justify-self: end; }
.grid-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: var(--fs-mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2); padding: 6px 10px; border: 1px solid var(--hair);
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.grid-toggle:hover { color: var(--ink); border-color: var(--ink); }
.grid-toggle .dot { width: 11px; height: 11px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 0 50%, transparent 50%); border: 1.5px solid var(--ink); }
.grid-on .grid-toggle { color: var(--signal); border-color: var(--signal); background: color-mix(in srgb, var(--signal) 8%, transparent); }
.grid-on .grid-toggle .dot { background: linear-gradient(90deg, var(--signal) 0 50%, transparent 50%); border-color: var(--signal); }

@media (max-width: 720px) {
  .mast-center { display: none; }
  .masthead { grid-template-columns: 1fr auto; }
}

/* ============================================================
   GRID SCAFFOLD (toggle) — the shared coordinate system
   ============================================================ */
.scaffold {
  position: fixed; inset: 0; z-index: 80; pointer-events: none;
  opacity: 0; transition: opacity .5s var(--ease);
}
.grid-on .scaffold { opacity: 1; }
.scaffold .cols, .scaffold .rows { position: absolute; inset: 0; }
.scaffold .v, .scaffold .h { position: absolute; background: var(--signal); opacity: .16; }
.scaffold .v { top: 0; bottom: 0; width: 1px; transform: scaleY(0); transform-origin: top; transition: transform .6s var(--ease); }
.scaffold .h { left: 0; right: 0; height: 1px; transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); }
.grid-on .scaffold .v { transform: scaleY(1); }
.grid-on .scaffold .h { transform: scaleX(1); }
.scaffold label {
  position: absolute; font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--signal); opacity: .7; transform: translate(-50%, 0);
}
.scaffold .col-lab { top: calc(var(--mast) + 4px); }
.scaffold .row-lab { left: 6px; transform: translate(0, -50%); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative; z-index: 1;
  min-height: 100svh; padding-top: calc(var(--mast) + clamp(40px, 9vh, 120px));
  padding-bottom: var(--s5);
  display: flex; flex-direction: column; justify-content: center;
}
.hero-coord {
  display: flex; flex-wrap: wrap; gap: 8px 28px; color: var(--ink-2);
  margin-bottom: clamp(20px, 4vh, 48px);
  opacity: 0; transform: translateY(12px);
  animation: rise .8s var(--ease) .15s forwards;
}
.hero-coord .sig { color: var(--signal); }

.hero-stage { position: relative; }
.hero-headline {
  position: relative; z-index: 2;
  font-family: var(--display);
  font-weight: 900; font-stretch: 125%;
  font-variation-settings: "wght" 900, "wdth" 125;
  font-size: var(--fs-display);
  line-height: 0.86; letter-spacing: -0.02em; text-transform: uppercase;
}
.hero-headline .line { display: block; }
.hero-headline .line.indent { padding-left: clamp(0px, 8vw, 12ch); }
.hero-headline .amp { font-weight: 400; font-stretch: 62%; font-variation-settings: "wght" 400, "wdth" 62; padding-inline: .12em; }
.hero-headline .lit { color: var(--signal); }

/* materialization: text hidden until pixels resolve */
.hero-headline.materializing { opacity: 0; }
.hero-headline.revealed { opacity: 1; transition: opacity .6s var(--ease); }

.hero-pixels {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none;
  transition: opacity .6s var(--ease);
}

.hero-lead {
  align-self: flex-end; max-width: 42ch; margin-top: clamp(32px, 6vh, 72px);
  font-size: var(--fs-lead); line-height: 1.4; color: var(--ink);
  text-align: right; text-wrap: balance;
  opacity: 0; transform: translateY(14px);
  animation: rise .9s var(--ease) .5s forwards;
}
.hero-lead b { color: var(--signal); font-weight: 600; }

.hero-cue {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: clamp(32px, 7vh, 80px); padding-top: 14px;
  border-top: 1px solid var(--hair); color: var(--ink-2);
  opacity: 0; animation: rise .9s var(--ease) .7s forwards;
}
.hero-cue .down { display: inline-flex; align-items: center; gap: 8px; }
.hero-cue .arrow { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

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

/* ============================================================
   MARQUEE
   ============================================================ */
.marquee {
  position: relative; z-index: 1; overflow: hidden;
  border-block: 1px solid var(--ink);
  background: var(--ink); color: var(--paper);
  padding-block: 12px;
}
.marquee ul { display: flex; width: max-content; gap: 0; animation: slide 32s linear infinite; }
.marquee li { display: inline-flex; align-items: center; font-family: var(--mono); font-size: var(--fs-mono); letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }
.marquee li::after { content: "◧"; margin-inline: 2.4em; color: var(--signal); }
@keyframes slide { to { transform: translateX(-50%); } }
.marquee:hover ul { animation-play-state: paused; }

/* ============================================================
   SECTION SHELL  (padding lives ONLY here — no element override)
   ============================================================ */
.section { position: relative; z-index: 1; padding-block: var(--pad-y); }

.sec-head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline;
  gap: 16px; margin-bottom: clamp(40px, 7vh, 88px);
  padding-bottom: 18px; border-bottom: 1px solid var(--ink);
}
.sec-head .idx { font-family: var(--mono); font-size: var(--fs-mono); color: var(--signal); }
.sec-head h2 {
  font-family: var(--display); font-weight: 800; font-stretch: 125%;
  font-variation-settings: "wght" 800, "wdth" 125;
  font-size: var(--fs-h2); line-height: .9; letter-spacing: -.015em; text-transform: uppercase;
  grid-column: 1 / -1; margin-top: 10px;
}
.sec-head .meta { grid-column: 3; justify-self: end; color: var(--ink-2); }

/* ============================================================
   SELECTED WORK
   ============================================================ */
.work-list { display: flex; flex-direction: column; gap: clamp(56px, 9vh, 128px); }

.work {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px 24px; align-items: end;
}
.work-media {
  position: relative; grid-column: span 7; aspect-ratio: 16 / 10;
  border: 1px solid var(--hair); overflow: hidden;
}
.work-body { grid-column: span 5; }
.work.is-object .work-media { grid-column: 6 / 13; }
.work.is-object .work-body { grid-column: 1 / 6; grid-row: 1; text-align: right; }

.work-tag { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--ink-2); }
.work-tag .pip { width: 8px; height: 8px; }
.is-screen .work-tag .pip { background: var(--signal); box-shadow: 0 0 10px var(--signal); }
.is-object .work-tag .pip { background: var(--ink); }
.is-screen .work-tag .state { color: var(--signal); }

.work-title {
  font-family: var(--display); font-weight: 800; font-stretch: 110%;
  font-variation-settings: "wght" 800, "wdth" 110;
  font-size: clamp(1.9rem, 4.4vw, 3.4rem); line-height: .92; letter-spacing: -.01em; text-transform: uppercase;
}
.work-desc { margin-top: 14px; max-width: 34ch; color: var(--ink-2); }
.is-object .work-desc { margin-left: auto; }
.work-foot { margin-top: 18px; display: flex; gap: 8px 22px; flex-wrap: wrap; color: var(--ink-2); }
.is-object .work-foot { justify-content: flex-end; }

/* media surfaces enforce the rule: screen glows, object is matte grayscale */
.work-media .plate { position: absolute; inset: 0; display: grid; place-items: center; }
.is-screen .work-media { background: radial-gradient(120% 120% at 30% 0%, #101018 0%, #0b0b12 100%); }
.is-screen .work-media::after { /* scanline sheen */
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(110,123,255,.05) 3px 4px);
  mix-blend-mode: screen; animation: scan 6s linear infinite;
}
@keyframes scan { to { transform: translateY(4px); } }
.is-object .work-media { background: linear-gradient(160deg, var(--paper-2) 0%, var(--concrete) 100%); }

.work-media svg { width: 78%; height: 78%; overflow: visible; }
.is-screen .stroke { stroke: var(--signal-2); }
.is-screen .fill { fill: var(--signal); }
.is-object .stroke { stroke: var(--ink); }
.is-object .fill { fill: var(--ink); }

.work-media .visual { transition: transform .7s var(--ease); }
.work:hover .work-media .visual { transform: scale(1.03); }
.is-screen:hover .work-media { box-shadow: inset 0 0 60px rgba(35,56,255,.25); }

/* svg atoms */
.dash { stroke-dasharray: 6 8; animation: march 3s linear infinite; }
@keyframes march { to { stroke-dashoffset: -28; } }
.spin-slow { transform-origin: center; animation: spin 22s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 3.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
.rise-bar { animation: riseBar 4s ease-in-out infinite alternate; }
@keyframes riseBar { to { transform: scaleY(.55); } }

/* the exception: the object that emits light */
.lamp-glow { filter: drop-shadow(0 0 14px var(--signal)); animation: pulse 3.4s ease-in-out infinite; }

@media (max-width: 860px) {
  .work { grid-template-columns: 1fr; gap: 16px; }
  .work-media, .work.is-object .work-media { grid-column: 1 / -1; }
  .work-body, .work.is-object .work-body { grid-column: 1 / -1; grid-row: auto; text-align: left; }
  .work.is-object .work-body { text-align: left; }
  .is-object .work-desc { margin-left: 0; }
  .is-object .work-foot { justify-content: flex-start; }
}

/* ============================================================
   CAPABILITIES MATRIX
   ============================================================ */
.matrix {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--ink);
}
.matrix .col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--ink);
  font-family: var(--display); font-weight: 800; font-stretch: 125%;
  font-variation-settings: "wght" 800, "wdth" 125;
  font-size: clamp(1.1rem, 2.4vw, 1.9rem); text-transform: uppercase; letter-spacing: -.01em;
}
.matrix .col-head.screen { color: var(--signal); border-right: 1px solid var(--ink); }
.matrix .col { display: flex; flex-direction: column; }
.matrix .col.screen { border-right: 1px solid var(--ink); }
.cap {
  display: flex; align-items: baseline; gap: 14px;
  padding: 18px 22px; border-bottom: 1px solid var(--hair-2);
  opacity: 0; transform: translateY(10px);
}
.cap.in { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .5s var(--ease); }
.cap:last-child { border-bottom: none; }
.cap .n { font-family: var(--mono); font-size: var(--fs-mono); color: var(--ink-2); }
.cap .name { font-size: clamp(1rem, 1.7vw, 1.3rem); font-weight: 500; }
.col.screen .cap .n { color: var(--signal); }
.matrix .cap:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.col.screen .cap:hover { background: color-mix(in srgb, var(--signal) 7%, transparent); }

@media (max-width: 700px) {
  .matrix { grid-template-columns: 1fr; }
  .matrix .col-head.screen, .matrix .col.screen { border-right: none; }
}

/* ============================================================
   STUDIO / MANIFESTO
   ============================================================ */
.manifesto { background: var(--ink); color: var(--paper); }
.manifesto .sec-head { border-color: rgba(242,241,236,.28); }
.manifesto .sec-head h2 { color: var(--paper); }
.manifesto .sec-head .idx { color: var(--signal-2); }
.manifesto .sec-head .meta { color: rgba(242,241,236,.55); }

.creed {
  font-family: var(--display); font-weight: 500; font-stretch: 100%;
  font-variation-settings: "wght" 500, "wdth" 100;
  font-size: var(--fs-mega); line-height: 1.02; letter-spacing: -.02em;
  max-width: 20ch; text-wrap: balance;
}
.creed em { font-style: normal; color: var(--signal-2); }
.creed .word { display: inline-block; opacity: 0; transform: translateY(0.4em); }
.creed.in .word { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .5s var(--ease); transition-delay: calc(var(--w) * 45ms); }

.creed-note {
  margin-top: clamp(40px, 7vh, 80px); margin-left: auto; max-width: 46ch;
  color: rgba(242,241,236,.72); font-size: var(--fs-lead); line-height: 1.45;
}
.creed-note b { color: var(--signal-2); font-weight: 600; }

/* ============================================================
   COLOPHON
   ============================================================ */
.colophon { background: var(--paper); padding-block: var(--s6) var(--s4); }
.colophon .legend {
  display: flex; flex-wrap: wrap; gap: 14px 40px; align-items: center;
  padding-bottom: var(--s5); margin-bottom: var(--s5);
  border-bottom: 1px solid var(--ink);
}
.legend .item { display: inline-flex; align-items: center; gap: 12px; color: var(--ink-2); }
.legend .sw { width: 22px; height: 22px; flex: none; }
.legend .sw.light { background: var(--signal); box-shadow: 0 0 16px var(--signal); }
.legend .sw.matter { background: var(--ink); }

.colo-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px 24px; }
.colo-brand {
  font-family: var(--display); font-weight: 900; font-stretch: 125%;
  font-variation-settings: "wght" 900, "wdth" 125;
  font-size: clamp(2.4rem, 8vw, 6rem); line-height: .84; letter-spacing: -.02em; text-transform: uppercase;
}
.colo-col h3 { font-family: var(--mono); font-size: var(--fs-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 14px; }
.colo-col a, .colo-col p { display: block; margin-bottom: 8px; }
.colo-col a { position: relative; width: fit-content; }
.colo-col a::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 100%; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease); }
.colo-col a:hover { color: var(--signal); }
.colo-col a:hover::after { transform: scaleX(1); transform-origin: left; }

.colo-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: var(--s6); color: var(--ink-2); }

@media (max-width: 760px) { .colo-grid { grid-template-columns: 1fr 1fr; } .colo-brand { grid-column: 1 / -1; } }

/* ============================================================
   READOUTS (spec-sheet HUD)
   ============================================================ */
.readout {
  position: fixed; z-index: 85; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2);
  pointer-events: none; mix-blend-mode: multiply;
}
.readout.scroll { left: var(--gutter); bottom: 16px; }
.readout.scroll .sig { color: var(--signal); }
.readout.ptr { right: var(--gutter); bottom: 16px; }
@media (max-width: 720px) { .readout { display: none; } }

/* ============================================================
   MOTION PREFERENCES
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .hero-headline.materializing { opacity: 1; }
  .hero-coord, .hero-lead, .hero-cue { opacity: 1 !important; transform: none !important; }
  .cap, .creed .word { opacity: 1 !important; transform: none !important; }
  .hero-pixels { display: none; }
}
