/* ============================================================
   DHPA — Case Study
   Design system: "Clearance"
   A security-badge / access-terminal identity built for a project
   that was, at its core, about deciding who gets to see what.
   Monospace carries every line of type on the page, on purpose:
   this was a developer's project before it was a designer's, and
   the type system says so instead of hiding it. The signature
   motif is the access badge, a rounded card with a lanyard notch,
   reused as the section marker the way other case studies on this
   site reuse their own project-specific icon.

   Palette: steel navy with a brass accent, standing in for a
   security badge rather than a screen glowing green. Brass marks
   anything that required a real decision, cream carries headings,
   a cooler slate blue is reserved for confirmed or tested outcomes.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --navy:        #16232E;
  --navy-2:      #101C26;
  --surface:     #1E2F3D;
  --surface-2:   #24384A;
  --cream:       #F1EAD8;
  --ink-soft:    #C9D3DB;
  --ink-quiet:   #8A97A2;
  --line:        rgba(241, 234, 216, 0.10);
  --line-strong: rgba(241, 234, 216, 0.20);

  --brass:       #C9A227;
  --brass-bright:#E0BB46;
  --brass-soft:  rgba(201, 162, 39, 0.14);
  --brass-line:  rgba(201, 162, 39, 0.32);

  --slate:       #6E93A8;
  --slate-soft:  rgba(110, 147, 168, 0.14);
  --slate-line:  rgba(110, 147, 168, 0.32);

  --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --measure: 660px;
  --measure-wide: 960px;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;
  --space-7: 9rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--navy);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 16.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

a { color: var(--brass-bright); text-decoration: none; cursor: pointer; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 3px;
  border-radius: 2px;
}

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

/* ---------- Terminal grid backdrop ----------
   A faint fixed grid behind the whole page, brass-tinted rather
   than the cooler green a literal terminal would use, so it reads
   as "secure system" without borrowing hacker-movie cliches. */

#terminal-grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(201, 162, 39, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 162, 39, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
}

/* ---------- Access spine — the page's connective signature ----------
   A thin vertical line down the page center, filling with brass as
   you read, the same scroll-progress device every other case study
   on this site uses, restyled as a card reader's status line. */

.access-spine {
  position: fixed;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: var(--line);
  z-index: 1;
  pointer-events: none;
}

.access-spine::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: var(--access-progress, 0%);
  background: linear-gradient(180deg, var(--brass-bright), var(--brass));
  transition: height 0.1s linear;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: rgba(16, 28, 38, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-strong);
}

.site-header .logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-header .logo img {
  height: 28px;
  width: auto;
  display: block;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.site-header nav a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  padding-bottom: 2px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-header nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0%;
  height: 1px;
  background: var(--brass-bright);
  transition: width 0.25s ease;
}

.site-header nav a:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--cream);
  cursor: pointer;
  border-radius: 8px;
}

.nav-toggle:hover { background: var(--surface); }

.nav-links-mobile {
  display: none;
  list-style: none;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  position: relative;
  z-index: 49;
  margin: 0;
  padding: 0;
}

.nav-links-mobile.is-open { display: flex; }

.nav-links-mobile li { border-top: 1px solid var(--line); }
.nav-links-mobile li:first-child { border-top: none; }

.nav-links-mobile a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 var(--space-3);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
}

/* ---------- Hero ---------- */

.hero {
  min-height: 84vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-6) var(--space-3) var(--space-5);
  position: relative;
  z-index: 2;
}

.hero-badge {
  width: 60px;
  height: 76px;
  margin-bottom: var(--space-4);
  opacity: 0;
  animation: rise 1s ease forwards;
  animation-delay: 0.1s;
}

.hero-badge svg { width: 100%; height: 100%; }

.hero-eyebrow {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-bright);
  margin-bottom: var(--space-3);
  opacity: 0;
  animation: rise 0.9s ease forwards;
  animation-delay: 0.25s;
}

.hero-eyebrow::before { content: '> '; }

.hero h1 {
  font-weight: 700;
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  line-height: 1.28;
  color: var(--cream);
  max-width: 19ch;
  margin: 0 0 var(--space-4);
  opacity: 0;
  animation: rise 1s ease forwards;
  animation-delay: 0.4s;
}

.hero p.lede {
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
  color: var(--ink-quiet);
  max-width: 46ch;
  margin: 0 auto var(--space-5);
  opacity: 0;
  animation: rise 1s ease forwards;
  animation-delay: 0.6s;
}

.hero .scroll-cue {
  opacity: 0;
  animation: rise 1s ease forwards, float 2.6s ease-in-out infinite;
  animation-delay: 0.8s, 1.7s;
  color: var(--brass-bright);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  font-weight: 500;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------- Metadata strip ---------- */

.meta-strip {
  max-width: var(--measure-wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-6);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 2;
}

.meta-item .label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-bright);
  margin-bottom: 0.4rem;
  display: block;
}

.meta-item .value {
  font-size: 0.88rem;
  color: var(--cream);
  line-height: 1.55;
}

/* ---------- Sections ---------- */

.section {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-6) var(--space-3);
  scroll-margin-top: 90px;
  position: relative;
  z-index: 2;
}

.section.wide { max-width: var(--measure-wide); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.section-mark {
  width: 16px;
  height: 20px;
  flex-shrink: 0;
  color: var(--brass-bright);
}

.section h2 {
  font-weight: 700;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  color: var(--cream);
  margin: 0;
}

.section p {
  margin: 0 0 var(--space-3);
  color: var(--ink-soft);
}

.section p.hook-line {
  font-size: clamp(1.02rem, 2.6vw, 1.2rem);
  line-height: 1.65;
  color: var(--cream);
  text-align: center;
  max-width: 38ch;
  margin: 0 auto;
}

.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Honest framing callouts ---------- */

.note {
  background: var(--surface);
  border-left: 3px solid var(--brass);
  border-radius: 4px;
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0 var(--space-4);
}

.note .note-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brass-bright);
  display: block;
  margin-bottom: 0.4rem;
}

.note p { margin: 0; color: var(--ink-soft); }

/* ---------- Clearance rule callout (classification logic) ---------- */

.rule-block {
  margin: var(--space-4) 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.rule-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.rule-pill.lvl1 { background: var(--slate-soft); color: var(--slate); border: 1px solid var(--slate-line); }
.rule-pill.lvl3 { background: var(--brass-soft); color: var(--brass-bright); border: 1px solid var(--brass-line); }

.rule-arrow { color: var(--ink-quiet); font-size: 1.1rem; }

.rule-result {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--ink-quiet);
  max-width: 26ch;
}

.rule-result strong { color: var(--cream); }

/* ---------- Subsection blocks ---------- */

.subsection {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--line);
}

.subsection:first-of-type { border-top: none; padding-top: 0; }

.subsection h3 {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--cream);
  margin: 0 0 var(--space-2);
}

/* ---------- Screenshot frames ---------- */

.shot-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.shot-row.single { grid-template-columns: 1fr; }
.shot-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

.shot-frame {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: 4 / 5;
}

.shot-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  cursor: zoom-in;
  transition: filter 0.2s ease, transform 0.3s ease;
}

.shot-frame img:hover,
.shot-frame img:focus-visible {
  filter: brightness(1.06);
  transform: scale(1.01);
}

.shot-caption {
  font-size: 0.8rem;
  color: var(--ink-quiet);
  text-align: center;
  max-width: 52ch;
  margin: var(--space-2) auto 0;
  line-height: 1.65;
}

/* ---------- Before / after compare ---------- */

.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-2);
  align-items: start;
}

.compare-col .compare-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.compare-col.before .compare-label { color: var(--ink-quiet); }
.compare-col.after .compare-label { color: var(--brass-bright); }

.compare-col.after .shot-frame { border-color: var(--brass-line); }

/* ---------- Icon system showcase ---------- */

.icon-showcase {
  margin: var(--space-4) 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
}

.icon-showcase img { width: 100%; height: auto; display: block; }

/* ---------- Reflection card ---------- */

.reflection-card {
  background: var(--surface);
  border-radius: 14px;
  padding: var(--space-5) var(--space-4);
  border: 1px solid var(--line-strong);
}

.reflection-card .note { background: var(--navy-2); border-left-color: var(--brass); }

/* ---------- Footer / project nav ---------- */

.project-nav {
  border-top: 1px solid var(--line);
  padding: var(--space-6) var(--space-5);
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  max-width: var(--measure-wide);
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.project-nav a {
  flex: 1;
  padding: var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 0.2s ease, transform 0.2s ease;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.project-nav a:hover {
  border-color: var(--brass-line);
  transform: translateY(-2px);
}

.project-nav .direction {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brass-bright);
  margin-bottom: 0.3rem;
}

.project-nav .title {
  font-weight: 700;
  color: var(--cream);
  font-size: 0.92rem;
}

.project-nav a.next { text-align: right; }

.site-footer {
  text-align: center;
  padding: var(--space-4) var(--space-3) var(--space-5);
  font-size: 0.8rem;
  color: var(--ink-quiet);
  position: relative;
  z-index: 2;
}

/* ---------- Image lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(10, 16, 22, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}

.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox-img {
  max-width: min(92vw, 1400px);
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.6);
  background: var(--surface);
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.lightbox.is-open .lightbox-img { transform: scale(1); }

.lightbox-close {
  position: fixed;
  top: var(--space-3);
  right: var(--space-3);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--cream);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  border-color: var(--brass-bright);
  background: var(--navy-2);
}

@media (max-width: 480px) {
  .lightbox { padding: var(--space-2); }
  .lightbox-close { top: var(--space-2); right: var(--space-2); width: 40px; height: 40px; }
}

/* ============================================================
   RESPONSIVE — 760px and below
   ============================================================ */

@media (max-width: 760px) {

  .access-spine { display: none; }

  .site-header { padding: 0 var(--space-3); height: 56px; }
  .site-header .logo img { height: 24px; }
  .site-header nav { display: none; }
  .nav-toggle { display: flex; order: -1; }
  .site-header .logo { order: 1; }

  .nav-links-mobile.is-open {
    position: fixed;
    top: var(--mobile-nav-offset, 56px);
    left: 0;
    right: 0;
    max-height: calc(100vh - var(--mobile-nav-offset, 56px));
    overflow-y: auto;
    z-index: 49;
  }

  .hero { min-height: 78vh; padding: var(--space-5) var(--space-3) var(--space-4); }
  .hero-badge { width: 48px; height: 62px; }
  .hero h1 { font-size: clamp(1.6rem, 7vw, 2.1rem); max-width: none; }
  .hero p.lede { font-size: 0.95rem; max-width: none; margin-bottom: var(--space-4); }

  .meta-strip {
    grid-template-columns: repeat(2, 1fr);
    padding: var(--space-3) var(--space-3) var(--space-4);
    gap: var(--space-2) var(--space-3);
  }

  .section { padding: var(--space-4) var(--space-3); }
  .section-head { margin-bottom: var(--space-3); gap: var(--space-1); }

  .rule-block { flex-direction: column; align-items: flex-start; }
  .rule-result { margin-left: 0; max-width: none; }

  .shot-row { grid-template-columns: 1fr; }
  .shot-row.cols-3 { grid-template-columns: 1fr; }
  .compare-row { grid-template-columns: 1fr; }

  .reflection-card { padding: var(--space-3) var(--space-3); border-radius: 10px; }

  .project-nav {
    flex-direction: column;
    padding: var(--space-4) var(--space-3);
    gap: var(--space-2);
  }

  .project-nav a { flex: none; width: 100%; }
  .project-nav a.next { text-align: left; }
}

@media (max-width: 480px) {

  :root {
    --space-4: 2rem;
    --space-5: 3rem;
    --space-6: 4rem;
  }

  body { font-size: 15.5px; }

  .site-header {
    flex-wrap: wrap;
    row-gap: 0.5rem;
    height: auto;
    padding: var(--space-2) var(--space-3);
  }

  .site-header nav { gap: var(--space-2); }
  .site-header nav a { font-size: 0.82rem; min-height: 36px; }

  .hero { min-height: 74vh; }
  .hero h1 { font-size: clamp(1.4rem, 8vw, 1.9rem); line-height: 1.35; }

  .meta-strip { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .meta-item .value { font-size: 0.82rem; word-break: break-word; }

  .section h2 { font-size: clamp(1.05rem, 6vw, 1.35rem); }
  .hook-line { font-size: clamp(0.95rem, 4.5vw, 1.1rem) !important; }

  .subsection h3 { font-size: 0.95rem; }

  .note, .rule-block { padding: var(--space-2); }
}
