/* =====================================================================
   benhdodge.com — styles.css
   ---------------------------------------------------------------------
   Restyled 2026-07-04 per the showcase-restyle decision record.
   Palette and type are defined once, below, as CSS variables.
   Change a value there and it propagates through the whole page.

   PALETTE: gunmetal elevation ladder + steel/ice accent. Every text
   token is contrast-verified in code (contrast.js gate) at WCAG AAA
   (>=7:1) against every surface it sits on; control borders hold
   >=3:1 against their fields. Do not darken --muted or --warn, or
   thin --edge-strong, without re-running the gate.

   TYPE SYSTEM: Oswald (display + micro-labels, tracked caps) over
   Source Sans 3 (body) — the same pairing the BRACE site uses, so
   type is the family thread while the palette carries the split.

   SIGNATURE: a static two-scale engineering grid drawn on the page
   background. It is backdrop, not signal — decorative opacity,
   exempt from contrast gating, invisible to screen readers.

   MOTION POLICY: micro only. Hover and focus states may transition
   color/border for <=200ms. Nothing moves on its own, nothing fades
   in or out, no animation on unlock. The grid is static.
   ===================================================================== */

:root {
  /* ---- Surfaces (darkest -> lightest, the elevation ladder) ---- */
  --ink:           #0B1017;   /* step 0 — page background        */
  --field:         #0D141E;   /* step 0.5 — input wells          */
  --panel:         #121C29;   /* step 1 — cards, gate panel      */
  --panel-2:       #182536;   /* step 2 — hover / preview floors */

  /* ---- Lines ---- */
  --edge:          #243141;   /* hairline structure              */
  --edge-strong:   #52708F;   /* control borders (>=3:1 vs field)*/

  /* ---- Text (AAA-gated) ---- */
  --text:          #E6ECF3;   /* primary                         */
  --muted:         #A4B4C4;   /* secondary — do not darken       */

  /* ---- Steel / ice accent ---- */
  --accent:        #8FB3CC;   /* steel — micro accents, ticks    */
  --accent-strong: #C6E0F2;   /* focus rings, hover lift         */
  --ice:           #A9CFE9;   /* filled primary button           */
  --ice-ink:       #0B1017;   /* text on ice fills               */

  /* ---- Status ---- */
  --warn:          #E39880;   /* error text (AAA on panel)       */

  /* ---- Type ---- */
  --font-display: "Oswald", "Arial Narrow", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-body:    "Source Sans 3", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-micro:   var(--font-display);

  /* ---- Engineering grid (signature backdrop) ---- */
  --grid-minor: rgba(143, 179, 204, 0.030);
  --grid-major: rgba(143, 179, 204, 0.055);
}

/* ---- Reset / base ---------------------------------------------------- */

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

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

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--ink);
  /* Two-scale engineering grid: 24px minor, 120px major. */
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Faint overhead glow — depth cue only, sits under all content. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    1100px 520px at 50% -8%,
    rgba(143, 179, 204, 0.07),
    transparent 62%
  );
}

::selection {
  background: rgba(169, 207, 233, 0.3);
}

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

/* ---- Micro-label voice ------------------------------------------------
   The single tracked-caps treatment used by the header, footer, field
   label, eyebrow, tags, index numbers, and buttons. Oswald carries it.
   (.gate-error is deliberately NOT in this group — errors read in
   sentence case for legibility under stress.) */

.site-header,
.site-footer,
.field-label,
.eyebrow,
.card-meta,
.button {
  font-family: var(--font-micro);
  font-weight: 500;
  text-transform: uppercase;
}

/* ---- Header / footer ------------------------------------------------- */

.site-header,
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 2rem;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.site-header {
  border-bottom: 1px solid var(--edge);
  font-size: 0.76rem;
}

.brand {
  color: var(--text);
}

.site-footer {
  border-top: 1px solid var(--edge);
  font-size: 0.72rem;
}

/* ---- Layout ----------------------------------------------------------- */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---- Locked view (gate) ----------------------------------------------- */

.gate {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 0;
}

.gate h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  letter-spacing: 0.045em;
  text-transform: uppercase;
  line-height: 1.05;
  margin: 0 0 1rem;
}

.tagline {
  color: var(--muted);
  max-width: 46ch;
  font-size: 1.06rem;
  margin: 0 0 3rem;
}

/* Shared surface for the password panel and project cards.
   Each panel sits one ladder step above the gridded page, lifted by
   a hairline, a soft drop, and a faint top sheen. The ::before /
   ::after pseudo-elements draw the registration ticks on opposing
   corners — panels read as plotted fixtures on the grid. */
.panel,
.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(143, 179, 204, 0.05), transparent 26%),
    var(--panel);
  border: 1px solid var(--edge);
  border-radius: 2px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.panel::before,
.card::before,
.panel::after,
.card::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  z-index: 2;
  transition: border-color 0.18s ease;
}

.panel::before,
.card::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
}

.panel::after,
.card::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
}

.panel {
  width: min(430px, 100%);
  padding: 1.7rem 1.75rem 1.1rem;
  text-align: left;
}

.field-label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.field-row {
  display: flex;
  gap: 0.6rem;
}

input[type="password"] {
  flex: 1;
  min-width: 0;
  background: var(--field);
  border: 1px solid var(--edge-strong);
  border-radius: 2px;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  padding: 0.66rem 0.8rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="password"]:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(169, 207, 233, 0.22);
}

input[type="password"][aria-invalid="true"] {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px rgba(227, 152, 128, 0.18);
}

/* Reserved height prevents the layout from shifting when the error
   appears. Sentence case, body face, sized to survive glare. */
.gate-error {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  color: var(--warn);
  min-height: 1.35rem;
  margin: 0.75rem 0 0;
}

/* ---- Buttons ----------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--edge-strong);
  border-radius: 2px;
  padding: 0.66rem 1.15rem;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.button:hover {
  background: rgba(143, 179, 204, 0.12);
  border-color: var(--accent-strong);
}

.button .arrow {
  color: var(--accent);
  transition: color 0.18s ease;
}

.button:hover .arrow {
  color: var(--accent-strong);
}

/* Filled primary — the gate's Enter button. Ice surface, ink text:
   the highest-contrast object on the page, findable in direct sun. */
.button-fill {
  background: var(--ice);
  border-color: var(--ice);
  color: var(--ice-ink);
  font-weight: 600;
}

.button-fill:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

/* ---- Unlocked view (dashboard) ----------------------------------------- */

.dashboard {
  padding: 3.25rem 0 4.5rem;
}

.dashboard-intro {
  margin: 0 0 2.5rem;
}

.eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

/* The post-unlock welcome line. Lead words carry full weight;
   the rest sits muted. Edit the text in index.html. */
.welcome {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--muted);
  max-width: 46ch;
  margin: 0;
}

.welcome strong {
  font-weight: 700;
  color: var(--text);
}

.welcome:focus {
  outline: 2px solid var(--accent-strong); /* F-25: keep the post-unlock focus target visible */
  outline-offset: 3px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr));
  gap: 1.4rem;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  transition: border-color 0.18s ease;
}

.card:hover {
  border-color: var(--edge-strong);
}

.card:hover::before,
.card:hover::after {
  border-color: var(--accent-strong);
}

/* ---- Mini homepage previews -------------------------------------------
   Each card embeds the project's live homepage in a scaled-down frame
   (or a screenshot, if the project sets image: "..." in script.js).
   The shield sits on top so the embedded page can't capture clicks. */

.card-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--field);
  border-bottom: 1px solid var(--edge);
}

.card-preview iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1200px;  /* matches PREVIEW_WIDTH in script.js */
  height: 750px;
  border: 0;
  transform-origin: 0 0;
  pointer-events: none;
  background: #fff;
}

.card-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.preview-shield {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.6rem 1.6rem;
}

/* Spec-sheet meta row: index number left, domain tag right. */
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  margin: 0 0 1.05rem;
}

.card-no {
  color: var(--accent);
}

.card-tag {
  color: var(--muted);
  text-align: right;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.38rem;
  letter-spacing: 0.02em;
  margin: 0 0 0.6rem;
}

.card-desc {
  color: var(--muted);
  font-size: 0.98rem;
  margin: 0 0 1.75rem;
}

/* Keeps "Open Project" aligned to the bottom of every card,
   regardless of description length. */
.card-link {
  margin-top: auto;
  align-self: flex-start;
}

/* ---- Small screens ------------------------------------------------------ */

@media (max-width: 640px) {
  .site-header,
  .site-footer {
    padding: 1rem 1.25rem;
  }

  main {
    padding: 0 1.25rem;
  }

  .panel {
    padding: 1.5rem 1.25rem 1rem;
  }
}

@media (max-width: 420px) {
  .field-row {
    flex-direction: column;
  }

  .field-row .button {
    width: 100%;
  }
}

/* ---- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ---- Two level index columns: Projects | Tools ---- */
.dashboard-cols{display:grid;grid-template-columns:minmax(0,1fr) minmax(320px,380px);gap:1.6rem;align-items:start}
.col-title{margin:0 0 1rem;padding-bottom:.55rem;border-bottom:1px solid rgba(255,255,255,.14)}
.tools-grid{display:grid;gap:1.4rem}
.tools-grid .card-preview iframe{pointer-events:none}
@media (max-width:1020px){.dashboard-cols{grid-template-columns:1fr}.tools-col{margin-top:1.6rem}}

/* The locked landing fits the visible browser viewport, including tablet
   toolbar changes. Its bottom row is reserved for the footer instead of
   being pushed below the fold by the gate's intrinsic flex minimum. */
body.password-landing {
  --landing-footer-size: calc(44px + env(safe-area-inset-bottom, 0px));
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) var(--landing-footer-size);
  overflow: hidden;
}

body.password-landing .site-header {
  min-height: 52px;
  padding-block: calc(.8rem + env(safe-area-inset-top, 0px)) .8rem;
}

body.password-landing .site-footer {
  min-height: 0;
  padding-block: .5rem calc(.5rem + env(safe-area-inset-bottom, 0px));
}

body.password-landing main,
body.password-landing #gate,
body.password-landing .site-header,
body.password-landing .site-footer {
  min-width: 0;
  min-height: 0;
}

body.password-landing #gate {
  /* More space below the form keeps it above the aircraft's flight lane.
     The reserve scales with visible height rather than a tablet model. */
  padding-block: clamp(1rem, 3.2vh, 3rem) clamp(5rem, 15vh, 13.5rem);
  padding-block: clamp(1rem, 3.2dvh, 3rem) clamp(5rem, 15dvh, 13.5rem);
}

body.password-landing #gate > h2,
body.password-landing #gate > .tagline,
body.password-landing #gate > .panel {
  flex-shrink: 0;
}

body.password-landing .tagline {
  margin-bottom: clamp(1.25rem, 3.5vh, 2.5rem);
  margin-bottom: clamp(1.25rem, 3.5dvh, 2.5rem);
}

@media (max-width: 700px) {
  body.password-landing .site-header,
  body.password-landing .site-footer {
    padding-inline: max(1.1rem, env(safe-area-inset-left, 0px)) max(1.1rem, env(safe-area-inset-right, 0px));
  }

  body.password-landing main {
    padding-inline: max(1.1rem, env(safe-area-inset-left, 0px)) max(1.1rem, env(safe-area-inset-right, 0px));
  }

  body.password-landing .gate h2 {
    margin-bottom: .85rem;
  }

  body.password-landing .panel {
    padding: 1.15rem 1rem .85rem;
  }

  /* A single 44px input row leaves the same room for the scene on narrow
     phones. The password remains at 16px to avoid focus zoom on iOS. */
  body.password-landing .field-row {
    flex-direction: row;
  }

  body.password-landing .field-row .button {
    flex: 0 0 auto;
    width: auto;
    padding-inline: .95rem;
  }
}

@media (max-height: 520px) {
  body.password-landing {
    --landing-footer-size: calc(36px + env(safe-area-inset-bottom, 0px));
  }

  body.password-landing .site-header {
    min-height: 40px;
    padding-block: calc(.4rem + env(safe-area-inset-top, 0px)) .4rem;
  }

  body.password-landing .site-footer {
    font-size: .65rem;
    padding-block: .3rem calc(.3rem + env(safe-area-inset-bottom, 0px));
  }

  body.password-landing #gate {
    padding-block: .5rem 3.5rem;
  }

  body.password-landing .gate h2 {
    font-size: 2rem;
    margin-bottom: .5rem;
  }

  body.password-landing .tagline {
    font-size: .94rem;
    line-height: 1.35;
    margin-bottom: .75rem;
  }

  body.password-landing .panel {
    padding: .65rem 1rem .4rem;
  }

  body.password-landing .field-label {
    margin-bottom: .3rem;
  }

  body.password-landing .gate-error {
    margin-top: .35rem;
  }
}

/* In a short landscape viewport the rotor reaches farther toward the
   page centre. Move the access column into the left lane at this size. */
@media (min-width: 701px) and (max-height: 520px) {
  body.password-landing #gate {
    align-items: flex-start;
    text-align: left;
  }
}

@media (max-height: 360px) {
  body.password-landing .tagline {
    display: none;
  }
}

/* When a keyboard or a large accessibility text setting leaves less than
   a form's height, keep the focused controls reachable. Normal landing
   sizes remain a single screen; this only permits the gate itself to pan. */
@media (max-height: 300px) {
  body.password-landing #gate {
    justify-content: flex-start;
    overflow-y: auto;
    padding-block: .5rem 3.5rem;
    overscroll-behavior: contain;
  }

  body.password-landing .gate h2,
  body.password-landing .tagline {
    display: none;
  }
}
