/* ============================================================================
   hero-media.css - the loud parts.

   Two additions to the quiet base:
   1. A full-viewport dark opening plate on the homepage. The drama is scale and
      inversion against the light page below, not effects.
   2. Article media - covers, figures, diagrams - and a per-entry accent colour
      taken from each product's own palette.
   ============================================================================ */

/* ---------------------------------------------------------------- hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: stretch;
  background: var(--hero-bg);
  color: var(--hero-fg);
  overflow: hidden;
  isolation: isolate;
}

/* The scene. A real photograph carries personality that no gradient can fake -
   this is the same warm desk shot the 2015 site opened on.
   Swap --hero-image for a different scene; everything else keeps working. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center 62%;
  transform: scale(1.04);   /* hides any edge softness from the scale-up */
}
/* Phones, upright or on their side: the smaller copy of the same photo. */
@media (max-width: 48rem), (max-height: 32rem) {
  .hero::before { background-image: var(--hero-image-sm, var(--hero-image)); }
}

/* Scrim. Flat, not graduated - one even wash of warm near-black so the type
   has guaranteed contrast at every viewport without relying on the photo
   happening to be dark in the right places. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--hero-scrim);
}

.hero-in {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2rem;
  width: 100%;
  padding-block: clamp(1.5rem, 4vh, 2.5rem) clamp(1.75rem, 5vh, 3rem);
}

.hero-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.25rem; flex-wrap: wrap;
}
.hero-eyebrow {
  margin: 0;
  font-family: var(--font-meta);
  font-size: var(--s-2);
  font-weight: var(--meta-weight);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--hero-dim);
}
.hero-nav { display: flex; gap: 1.5rem; }
.hero-nav a {
  font-family: var(--font-meta);
  font-size: var(--s-2);
  font-weight: var(--meta-weight);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--hero-dim);
  text-decoration: none;
}
.hero-nav a:hover { color: var(--hero-fg); }

.hero-mid { display: grid; align-content: center; gap: 1.5rem; }

.hero-name {
  color: var(--hero-fg);
  font-family: var(--font-display);
  font-size: clamp(3rem, 13vw, 8.5rem);
  /* A phone on its side is wide but short: size by height as well, so the
     name, role and About button still fit on the first screen. */
  font-size: clamp(3rem, min(13vw, 19svh), 8.5rem);
  font-weight: var(--display-weight);
  line-height: .9;
  letter-spacing: var(--name-tracking);
}

.hero-role {
  display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap;
  margin: 0;
  font-family: var(--font-meta);
  font-size: clamp(.9rem, 2.4vw, 1.125rem);
  color: var(--hero-dim);
}
.hero-role-lead { color: var(--hero-dim); }
.rotator-word { color: var(--hero-fg); font-weight: 500; }
.rotator-caret {
  display: inline-block;
  width: 2px; height: 1.05em;
  margin-left: .1em;
  vertical-align: text-bottom;
  background: var(--hero-accent);
  animation: caret 1.05s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0 } }

.hero-bottom {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
}

.hero-btn {
  font-family: var(--font-meta);
  font-size: var(--s-2);
  font-weight: var(--meta-weight);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--hero-fg);
  background: transparent;
  border: 1px solid var(--hero-rule);
  padding: .85rem 1.7rem;
  cursor: pointer;
  transition: background .22s ease, color .22s ease, border-color .22s ease;
}
.hero-btn:hover { background: var(--hero-fg); color: var(--hero-bg); border-color: var(--hero-fg); }

.hero-scroll {
  display: inline-flex; flex-direction: column; align-items: center; gap: .6rem;
  font-family: var(--font-meta);
  font-size: .625rem;
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--hero-dim);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.hero-scroll:hover { color: var(--hero-fg); }
.hero-scroll svg { animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { transform: translateY(0); opacity: .55 }
  50%      { transform: translateY(4px); opacity: 1 }
}

/* 1px marker at the foot of the plate; drives the header reveal. */
.hero-sentinel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  pointer-events: none;
}

/* The section the hero scrolls into gets a little air above it. */
#read-on { scroll-margin-top: 0; }
/* The header drops in as the About button lands here, so on a phone the
   section's label needs to start below it (~58px) rather than under it. */
@media (max-width: 40rem) {
  #read-on { padding-top: 5.25rem; }
}

/* --------------------------------------------------- per-entry accent ---- */
/* Each product carries a colour from its own live palette. Set inline as
   --entry-l / --entry-d; this resolves the right one per theme. */
.has-entry { --entry: var(--entry-l, var(--accent)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .has-entry { --entry: var(--entry-d, var(--accent)); }
}
:root[data-theme="dark"] .has-entry { --entry: var(--entry-d, var(--accent)); }

/* ------------------------------------------------------ index thumbs ----- */
/* Work rows get a real thumbnail - the index stops being a wall of text. */
.irow--media { grid-template-columns: 7.5rem 1fr auto; }
@media (max-width: 40rem) {
  .irow--media { grid-template-columns: 4.5rem 1fr; }
  /* The domain drops under the title instead of fighting it for width. */
  .irow--media .irow-meta { grid-column: 2 / -1; }
}

.irow-thumb {
  grid-row: span 3;
  align-self: start;
  display: block;
  width: 100%;
  height: auto;   /* the height attribute is only there to reserve space */
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: top center;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--bg-2);
}
.irow--media .irow-sub,
.irow--media .irow-facts { grid-column: 2 / -1; }
.irow--media .irow-title { border-left: 3px solid var(--entry, var(--accent)); padding-left: .7rem; }
.irow--media:hover .irow-title { color: var(--entry, var(--accent)); }

/* ------------------------------------------------------- article cover -- */
.a-cover {
  margin-bottom: clamp(2rem, 5vw, 3rem);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--cover-bg, var(--bg-2));
}
.a-cover img { display: block; width: 100%; height: auto; }

/* A tinted rule under the title, in the entry's own colour. */
.a-head--entry { border-bottom: 0; padding-bottom: 0; }
.a-accent-rule {
  width: 3.5rem; height: 4px;
  margin-bottom: 1.5rem;
  background: var(--entry, var(--accent));
}
.a-tags {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-top: 1.25rem;
}
.a-tags span {
  font-family: var(--font-meta);
  font-size: .625rem;
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--fg-2);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: .25rem .7rem;
}

/* Links inside an accented article pick up the entry colour. */
.article--entry .prose a { text-decoration-color: color-mix(in srgb, var(--entry) 45%, transparent); }
.article--entry .prose a:hover { color: var(--entry); text-decoration-color: var(--entry); }
.article--entry .prose h2 { color: var(--fg); }
.article--entry .prose h2::before {
  content: "";
  display: block;
  width: 1.75rem; height: 3px;
  margin-bottom: .7rem;
  background: var(--entry, var(--accent));
}
.article--entry .prose blockquote { color: var(--fg); }
.article--entry .prose blockquote p::before,
.article--entry .prose blockquote p::after { color: var(--entry); }
.article--entry .prose pre { border-left-color: var(--entry, var(--rule-strong)); }

/* ------------------------------------------------------------ figures --- */
figure.fig { margin: 2.4em 0; }
figure.fig img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--bg-2);
}
figure.fig figcaption {
  margin-top: .7rem;
  padding-left: .8rem;
  border-left: 2px solid var(--entry, var(--rule-strong));
  font-family: var(--font-meta);
  font-size: var(--s-2);
  line-height: 1.5;
  color: var(--muted);
}

/* Two figures side by side - used for phone-shaped screenshots. */
.fig-pair {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  margin: 2.4em 0;
}
.fig-pair figure.fig { margin: 0; }

/* ----------------------------------------------------------- diagrams --- */
/* Inline SVG, drawn from theme tokens so it reads in light and dark. */
.diagram {
  margin: 2.4em 0;
  padding: 1.5rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--bg-2);
  overflow-x: auto;
}
.diagram svg { display: block; width: 100%; height: auto; min-width: 20rem; }
.diagram-cap {
  margin: .9rem 0 0;
  font-family: var(--font-meta);
  font-size: var(--s-2);
  color: var(--muted);
}
.d-box { fill: var(--bg); stroke: var(--rule-strong); }
.d-box-accent { fill: color-mix(in srgb, var(--entry, var(--accent)) 12%, var(--bg)); stroke: var(--entry, var(--accent)); }
.d-label { fill: var(--fg); font-family: var(--font-meta); font-size: 12px; font-weight: 600; }
.d-sub { fill: var(--muted); font-family: var(--font-meta); font-size: 12px; }
.d-line { stroke: var(--rule-strong); stroke-width: 1.5; fill: none; }
.d-line-accent { stroke: var(--entry, var(--accent)); stroke-width: 1.5; fill: none; }
.d-arrow { fill: var(--rule-strong); }
.d-arrow-accent { fill: var(--entry, var(--accent)); }

/* The name is set the way the 2020 site set it: Open Sans Light (300) at
   normal letter spacing, the Bootstrap jumbotron look. Only the name; other
   headings keep the site's display weight. */
.hero-name {
  font-family: 'Open Sans Variable', 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 300;
  letter-spacing: 0;
  line-height: 1;
}
:root[data-variant="classic"] .hero-name { line-height: 1; }

/* Detailed diagrams keep a readable size on phones and scroll sideways inside
   their frame instead of shrinking their labels to a few pixels. */
.diagram--wide svg { min-width: 36rem; }
.diagram--wide { -webkit-overflow-scrolling: touch; }

/* Phones, upright or sideways: the two 10px labels on public pages (the
   hero's Scroll hint and an article's stack pills) come up to the 12px floor
   the rest of the site keeps. */
@media (max-width: 40rem), (pointer: coarse) {
  .hero-scroll, .a-tags span { font-size: .75rem; }
}
@media (max-width: 40rem) {
  /* Squeezed to a 320px screen a diagram drew its labels at ~6px. Near full
     size it stays legible and scrolls sideways inside its own box instead. */
  .diagram svg { min-width: 36rem; }
}
