/* spidleweb.net — shared stylesheet
   Visual language: archive/brutalist editorial (see qa/experiments/formation).
   Paper + ink + one red accent, hairline rules, mono micro-labels,
   large expanded display type, hover inversions. */

@font-face {
  font-family: "GT America";
  src: url("fonts/Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "GT America Expanded";
  src: url("fonts/Expanded.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --paper: #f2f2ef;
  --ink: #0a0a0a;
  --accent: #fa1900;
  --line: color-mix(in srgb, var(--ink) 18%, transparent);
  --line-strong: var(--ink);
  --panel-paper: color-mix(in srgb, var(--paper) 70%, transparent);
  --frame-bg: #d9d9d5;
  --panel-line: color-mix(in srgb, var(--panel-fg, var(--paper)) 25%, transparent);

  --body: "GT America", Helvetica, Arial, sans-serif;
  --display: "GT America Expanded", "Arial Black", Helvetica, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --panel-w: 42vw;
  --gap: 24px;

  /* Type scale — 6 steps */
  --text-micro: 0.65rem;
  --text-small: 0.8rem;
  --text-body: 1rem;
  --text-title: clamp(1.35rem, 2.8vw, 2.5rem);
  --text-display: clamp(2rem, 4.5vw, 5rem);
  --text-hero: clamp(2.75rem, 6.5vw, 7.5rem);
}

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

html { scrollbar-width: thin; scrollbar-color: var(--ink) transparent; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 500;
  font-size: var(--text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--paper); }

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

a { color: inherit; }

/* ---- Micro labels ---- */

.micro {
  font-family: var(--mono);
  font-size: var(--text-micro);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

/* ---- Split layout: fixed dark panel + flowing archive ---- */

.viewport {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  align-items: start;
}

.panel {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--panel-bg, var(--ink));
  color: var(--panel-fg, var(--paper));
  clip-path: polygon(0 0, 100% 1.25%, 96.5% 100%, 0 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--gap);
  padding-right: calc(var(--gap) + 3.5vw);
  z-index: 10;
}

.panel a { text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .panel a:hover { color: var(--accent); }
}

.panel__meta {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  opacity: 0.7;
}

.panel__type {
  font-family: var(--display);
  text-transform: uppercase;
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: auto 0;
}

.panel__type span { display: block; }

.panel__footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel__blurb {
  max-width: 240px;
  font-size: var(--text-small);
  line-height: 1.45;
}

/* Home panel */
.panel--home .panel__type { font-size: var(--text-hero); }
.panel--home .panel__type span:nth-child(2) { padding-left: 0.18em; }
.panel--home .panel__meta { justify-content: flex-end; }

/* Case panel */
.panel--case .panel__type { font-size: var(--text-display); }

.panel__facts {
  display: grid;
  gap: 0;
  margin-top: var(--gap);
  border-top: 1px solid var(--panel-line);
  max-width: 320px;
}

.panel__facts > div {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  padding: 8px 0;
  border-bottom: 1px solid var(--panel-line);
}

.panel__facts dt { opacity: 0.55; }
.panel__facts dd { text-align: right; }

/* ---- Archive (right column) ---- */

.archive {
  min-width: 0;
  padding-left: 2vw;
}

.archive__header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line-strong);
  padding: var(--gap) var(--gap) 10px var(--gap);
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
}

.archive__nav {
  display: flex;
  gap: var(--gap);
}

.archive__header a { text-decoration: none; }
.archive__header a.is-active { color: var(--accent); }
.archive__header a:focus-visible { color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .archive__header a:hover { color: var(--accent); }
}

/* ---- Index rows ---- */

.index {
  list-style: none;
  padding: 0 var(--gap);
}

.index__row {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 5rem 1fr 4rem;
  gap: 16px;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--line-strong);
  text-decoration: none;
}

.index__row::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -12px;
  right: -12px;
  background: var(--row-accent, var(--ink));
  opacity: 0;
  z-index: -1;
}

/* Full-row inversion on hover/focus, matching the reference's list treatment */
.index__row:focus-visible {
  color: var(--paper);
  transform: translateX(12px);
  outline: none;
}
.index__row:focus-visible::before { opacity: 1; }

@media (hover: hover) and (pointer: fine) {
  .index__row {
    transition: color 0.15s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.15s cubic-bezier(0.23, 1, 0.32, 1);
  }
  .index__row::before {
    transition: opacity 0.15s cubic-bezier(0.23, 1, 0.32, 1);
  }
  .index__row:hover {
    color: var(--paper);
    transform: translateX(12px);
  }
  .index__row:hover::before { opacity: 1; }
}

.index__thumb {
  display: block;
  width: 5rem;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--frame-bg);
}

.index__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  filter: none;
}

@media (hover: hover) and (pointer: fine) {
  .index__thumb img {
    filter: grayscale(100%) contrast(1.05);
  }
  .index__row:hover .index__thumb img { filter: none; }
}

.index__row:focus-visible .index__thumb img { filter: none; }

.index__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.index__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--text-title);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.index__kind { font-size: var(--text-small); opacity: 0.75; }
.index__year { font-family: var(--mono); font-size: var(--text-small); text-align: right; align-self: baseline; padding-top: 4px; }

/* ---- Section headers within the archive ---- */

.section-head {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  padding: 14px var(--gap) 10px;
  border-bottom: 1px solid var(--line-strong);
  margin-top: 88px;
  font-size: var(--text-small);
}

/* ---- Sites grid ---- */

.sites {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap);
}

.site-card { position: relative; }

.site-card a { text-decoration: none; display: block; }

.site-card__frame {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--frame-bg);
}

.site-card__frame--crop-top img { object-position: left top; }

.site-card__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  filter: none;
  transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (hover: hover) and (pointer: fine) {
  .site-card__frame img {
    filter: grayscale(100%) contrast(1.05);
  }
}

.site-card a:focus-visible img {
  filter: none;
  transform: scale(1.03);
}

.site-card__caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
}

.site-card__caption .accent { color: var(--accent); }

@media (hover: hover) and (pointer: fine) {
  .site-card a:hover img {
    filter: none;
    transform: scale(1.03);
  }
  .site-card a:hover .site-card__name { text-decoration: underline; }
}

/* ---- Profile ---- */

.profile {
  padding: var(--gap);
}

.profile__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--text-title);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}

.profile__body p { margin-bottom: 1em; max-width: 58ch; }

.roster {
  list-style: none;
  border-top: 1px solid var(--line-strong);
  margin-top: 2.5em;
  max-width: 58ch;
}

.roster li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-strong);
}

.roster li > span:last-child { text-align: right; }

.roster__org {
  font-family: var(--body);
  font-weight: 500;
  text-transform: uppercase;
  font-size: var(--text-body);
  letter-spacing: 0;
  white-space: nowrap;
}

/* ---- Contact / footer ---- */

.contact { padding: 88px var(--gap) 32px; }

.contact__label { margin-bottom: 16px; }

.contact__mail {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: var(--text-title);
  text-transform: uppercase;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 6px;
}

@media (hover: hover) and (pointer: fine) {
  .contact__mail {
    transition: color 0.12s ease-out, border-color 0.12s ease-out;
  }
  .contact__mail:hover { color: var(--accent); border-color: var(--accent); }
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  padding: 48px var(--gap) var(--gap);
  opacity: 0.7;
}

.footer a { text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .footer a:hover { color: var(--accent); }
}

/* ---- Case study article ---- */

.article {
  padding: 0 var(--gap) var(--gap);
  max-width: 900px;
}

.article__section { margin-top: 72px; }

.article__head {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--text-title);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  max-width: 22ch;
  margin-bottom: 20px;
}

.article__section > p { max-width: 62ch; margin-bottom: 1em; }

.figure { margin-top: 40px; }

.figure__frame {
  border: 1px solid var(--line-strong);
  background: var(--frame-bg);
  overflow: hidden;
}

.figure__frame img {
  filter: none;
  width: 100%;
}

@media (hover: hover) and (pointer: fine) {
  .figure__frame img {
    filter: grayscale(100%) contrast(1.05);
  }
  .figure:hover .figure__frame img { filter: none; }
}

.figure figcaption {
  display: flex;
  gap: var(--gap);
  padding-top: 8px;
  opacity: 0.75;
}

/* Tall mobile captures: fixed-height frames the visitor can scroll */
.phones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-top: 40px;
}

.phones .figure { margin-top: 0; }

.phone-frame {
  border: 1px solid var(--line-strong);
  background: var(--frame-bg);
  height: 560px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}

.phone-frame img { width: 100%; }

/* ---- Case study results ---- */

.results {
  list-style: disc;
  padding-left: 1.25em;
  max-width: 62ch;
}

.results li {
  margin-bottom: 0.65em;
  font-size: var(--text-body);
  line-height: 1.5;
}

.results li:last-child { margin-bottom: 0; }

/* ---- Next-project handoff ---- */

.next {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin: 88px var(--gap) 0;
  padding: 28px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  text-decoration: none;
}

.next::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -12px;
  right: -12px;
  background: var(--ink);
  opacity: 0;
  z-index: -1;
}

.next:focus-visible {
  color: var(--paper);
  transform: translateX(12px);
  outline: none;
}
.next:focus-visible::before { opacity: 1; }
.next:focus-visible .next__arrow { color: var(--accent); }

@media (hover: hover) and (pointer: fine) {
  .next {
    transition: color 0.15s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.15s cubic-bezier(0.23, 1, 0.32, 1);
  }
  .next::before {
    transition: opacity 0.15s cubic-bezier(0.23, 1, 0.32, 1);
  }
  .next:hover {
    color: var(--paper);
    transform: translateX(12px);
  }
  .next:hover::before { opacity: 1; }
  .next:hover .next__arrow { color: var(--accent); }
}

.next__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--text-title);
  line-height: 1;
  text-transform: uppercase;
}

.next__arrow {
  font-family: var(--display);
  font-size: var(--text-display);
  line-height: 1;
}

/* ---- Reveal on scroll (progressive enhancement) ---- */

.js-active .reveal { opacity: 0; transform: translateY(14px); }

.js-active .reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.28s cubic-bezier(0.23, 1, 0.32, 1),
              transform 0.28s cubic-bezier(0.23, 1, 0.32, 1);
}

.index li:nth-child(1).reveal { transition-delay: 0ms; }
.index li:nth-child(2).reveal { transition-delay: 60ms; }
.index li:nth-child(3).reveal { transition-delay: 120ms; }
.index li:nth-child(4).reveal { transition-delay: 180ms; }

.sites li:nth-child(1).reveal { transition-delay: 0ms; }
.sites li:nth-child(2).reveal { transition-delay: 60ms; }
.sites li:nth-child(3).reveal { transition-delay: 120ms; }
.sites li:nth-child(4).reveal { transition-delay: 180ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .reveal.is-in { transition: none; }
  .site-card__frame img { transition: none; }
  .site-card a:hover img { transform: none; }
  .index__row, .next {
    transition: color 0.05s ease-out;
  }
  .index__row::before, .next::before {
    transition: opacity 0.05s ease-out;
  }
  .index__row:hover, .index__row:focus-visible,
  .next:hover, .next:focus-visible {
    transform: none;
  }
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
  .index__row { grid-template-columns: 4rem 1fr 3.5rem; gap: 12px; }
  .index__thumb { width: 4rem; }
}

@media (max-width: 768px) {
  .viewport { display: block; }

  .panel {
    position: static;
    height: auto;
    min-height: 0;
    clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%);
    padding: 20px var(--gap);
    gap: 20px;
  }

  .panel__meta { display: none; }

  .panel--home .panel__type { font-size: 11vw; margin: 16px 0; }
  .panel--case .panel__type { font-size: 10vw; margin: 16px 0 0; }

  .panel__blurb { max-width: none; }

  .archive { padding-left: 0; }
  .archive__header { position: static; }

  .sites { grid-template-columns: 1fr; }
  .phones { grid-template-columns: 1fr; }
  .phone-frame { height: 480px; }
  .section-head, .contact { margin-top: 0; }
  .section-head { margin-top: 64px; }
  .contact { padding-top: 64px; }

  .index__row {
    grid-template-columns: 2rem 1fr 3.5rem;
    gap: 8px;
  }
  .index__thumb {
    display: none;
  }
}

/* ---- Accessibility Utility ---- */

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

/* ---- Themes & colorize mappings ---- */

.theme-conservis {
  --c-chroma: calc(0.14 * var(--p-color-amount, 1));
  --paper-chroma: calc(0.006 * var(--p-color-amount, 1));
  --panel-chroma: calc(0.06 * var(--p-color-amount, 1));

  --paper: oklch(96.5% var(--paper-chroma) 140);
  --ink: oklch(13% var(--paper-chroma) 140);
  --accent: oklch(55% var(--c-chroma) 140);
  --panel-bg: oklch(22% var(--panel-chroma) 140);
}

.theme-vidscrip {
  --c-chroma: calc(0.13 * var(--p-color-amount, 1));
  --paper-chroma: calc(0.006 * var(--p-color-amount, 1));
  --panel-chroma: calc(0.06 * var(--p-color-amount, 1));

  --paper: oklch(96.5% var(--paper-chroma) 195);
  --ink: oklch(13% var(--paper-chroma) 195);
  --accent: oklch(55% var(--c-chroma) 195);
  --panel-bg: oklch(22% var(--panel-chroma) 195);
}

.theme-navigator {
  --c-chroma: calc(0.17 * var(--p-color-amount, 1));
  --paper-chroma: calc(0.006 * var(--p-color-amount, 1));
  --panel-chroma: calc(0.08 * var(--p-color-amount, 1));

  --paper: oklch(96.5% var(--paper-chroma) 260);
  --ink: oklch(13% var(--paper-chroma) 260);
  --accent: oklch(52% var(--c-chroma) 260);
  --panel-bg: oklch(20% var(--panel-chroma) 260);
}

.theme-omnitopia {
  --c-chroma: calc(0.19 * var(--p-color-amount, 1));
  --paper-chroma: calc(0.006 * var(--p-color-amount, 1));
  --panel-chroma: calc(0.08 * var(--p-color-amount, 1));

  --paper: oklch(96.5% var(--paper-chroma) 50);
  --ink: oklch(13% var(--paper-chroma) 50);
  --accent: oklch(60% var(--c-chroma) 50);
  --panel-bg: oklch(25% var(--panel-chroma) 50);
}

/* ---- Home index row custom hover accents ---- */
.index li:nth-child(1) {
  --row-accent: oklch(55% calc(0.14 * var(--p-color-amount, 1)) 140);
}
.index li:nth-child(2) {
  --row-accent: oklch(55% calc(0.13 * var(--p-color-amount, 1)) 195);
}
.index li:nth-child(3) {
  --row-accent: oklch(52% calc(0.17 * var(--p-color-amount, 1)) 260);
}
.index li:nth-child(4) {
  --row-accent: oklch(60% calc(0.19 * var(--p-color-amount, 1)) 50);
}
