/* =================================================================
   BloxDot — Brand tokens
   Architecture & Interior Design Studio • Lahore · Dubai · Beyond
   Sub-brand of HybridDot: inherits the red-dot punctuation and
   lowercase-title convention, flips the canvas from ink to bone.
   ================================================================= */

/* Google Fonts loaded via non-blocking <link> in each page's <head> — see index.html. */

:root {
  /* ------- Palette: warm neutrals on a bone canvas ------- */
  --bd-bone:       #F2EDE4;  /* paper — default surface */
  --bd-bone-soft:  #ECE5D8;
  --bd-plaster:    #E7DFD1;  /* warm secondary surface */
  --bd-stone:      #C9BFAF;  /* subtle dividers, muted fills */
  --bd-clay:       #6B5D47;  /* mid neutral, captions — a11y-safe on bone */
  --bd-graphite:   #3A3A38;  /* body text */
  --bd-ink:        #121212;  /* near-black headings, heavy type */
  --bd-brass:      #8A6428;  /* warm metallic accent — a11y-safe on bone */
  --bd-brass-soft: #D9BE8B;

  /* Inherited from HybridDot — used sparingly as signature dot + accent */
  --bd-crimson:    #C90D28;

  /* ------- Semantics ------- */
  --fg:            var(--bd-ink);
  --fg-body:       var(--bd-graphite);
  --fg-muted:      var(--bd-clay);
  --fg-subtle:     rgba(58, 58, 56, 0.48);

  --bg:            var(--bd-bone);
  --bg-soft:       var(--bd-bone-soft);
  --bg-warm:       var(--bd-plaster);
  --bg-ink:        var(--bd-ink);

  --rule:          rgba(18, 18, 18, 0.14);
  --rule-strong:   rgba(18, 18, 18, 0.32);
  --rule-soft:     rgba(18, 18, 18, 0.08);

  /* ------- Type ------- */
  --f-serif:       'Fraunces', 'Canela', 'Playfair Display', Georgia, serif;
  --f-sans:        'Montserrat', system-ui, -apple-system, Helvetica, Arial, sans-serif;

  /* Fraunces optical + variation defaults for display use */
  --f-display-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
  --f-serif-text-settings: "opsz" 14, "SOFT" 50;

  /* Type scale — editorial, generous */
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-28: 28px;
  --fs-32: 32px;
  --fs-40: 40px;
  --fs-48: 48px;
  --fs-64: 64px;
  --fs-80: 80px;
  --fs-96: 96px;
  --fs-128: 128px;
  --fs-160: 160px;

  /* ------- Layout ------- */
  --page-pad: clamp(24px, 5vw, 96px);
  --col-max: 1440px;
  --measure: 62ch;

  /* ------- Motion ------- */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur:  280ms;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg-body);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "ss02", "kern";
}

::selection { background: var(--bd-ink); color: var(--bd-bone); }

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

/* ---------- Typographic primitives ---------- */

/* Serif display — Fraunces at display opsz, moderate soft, low contrast on big sizes */
.serif, .serif-display {
  font-family: var(--f-serif);
  font-variation-settings: var(--f-display-settings);
  font-weight: 350;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--fg);
}
.serif-text {
  font-family: var(--f-serif);
  font-variation-settings: var(--f-serif-text-settings);
  font-weight: 400;
  line-height: 1.45;
  color: var(--fg);
}

.sans { font-family: var(--f-sans); }

/* BloxDot convention inherited from HybridDot:
   lowercase titles ending in a red dot. */
.dot-title {
  font-family: var(--f-serif);
  font-variation-settings: var(--f-display-settings);
  font-weight: 300;
  font-size: clamp(40px, 6vw, 80px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--fg);
  text-transform: lowercase;
  margin: 0;
}
.dot-title::after {
  content: '.';
  color: var(--bd-crimson);
  margin-left: 0.04em;
}

.eyebrow {
  font-family: var(--f-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg);
}
.caption {
  font-family: var(--f-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.meta {
  font-family: var(--f-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
}

p { margin: 0 0 1em; max-width: var(--measure); color: var(--fg-body); }
p.lede {
  font-family: var(--f-serif);
  font-variation-settings: var(--f-serif-text-settings);
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.4;
  color: var(--fg);
  font-weight: 350;
  max-width: 52ch;
}

/* Red-dot suffix for inline text ('permanence.' style) */
.rd::after { content: '.'; color: var(--bd-crimson); }

/* ---------- Inline body-copy links ----------
   Crimson accent on plain <a> tags inside body paragraphs and
   inline body containers. Excludes <a> with explicit style attr
   (drum-solo and trust-line links use color:inherit). */
p a:not([style]),
.a a:not([style]) {
  color: var(--bd-crimson);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease);
}
p a:not([style]):hover,
.a a:not([style]):hover {
  color: var(--bd-ink);
}

/* Hairline rules (the studio's signature graphic device) */
hr.rule {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 0;
}
hr.rule-strong { background: var(--rule-strong); }

/* ---------- Section scaffolding ---------- */
.page {
  max-width: var(--col-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.section {
  padding: clamp(80px, 12vh, 160px) 0;
  border-top: 1px solid var(--rule);
}
.section:first-of-type { border-top: 0; }

.section-head {
  display: grid;
  grid-template-columns: minmax(80px, 120px) 1fr;
  gap: clamp(24px, 4vw, 64px);
  margin-bottom: clamp(48px, 8vh, 96px);
  align-items: baseline;
}
.section-num {
  font-family: var(--f-sans);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--fg-muted);
  padding-top: 14px;
  border-top: 1px solid var(--fg);
  align-self: start;
}

/* =================================================================
   PRIMARY NAVIGATION — Services mega-menu + mobile drawer
   Each page's <header class="nav"> uses these tokens. Per-page
   `<style>` blocks still own .nav (sticky positioning, padding,
   on-light vs on-dark background) — this file owns the dropdown
   and mobile drawer behaviour.
   ================================================================= */

.nav-item-services {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-services-trigger {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  font-family: var(--f-sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  opacity: 0.72;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity var(--dur) var(--ease);
}
.nav-services-trigger::after {
  content: '';
  width: 5px;
  height: 5px;
  border-right: 1.25px solid currentColor;
  border-bottom: 1.25px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform var(--dur) var(--ease);
}
.nav-item-services:hover .nav-services-trigger,
.nav-item-services:focus-within .nav-services-trigger,
.nav-item-services:has(.nav-mega-link[aria-current="page"]) .nav-services-trigger {
  opacity: 1;
}
.nav-item-services:hover .nav-services-trigger::after,
.nav-item-services:focus-within .nav-services-trigger::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.nav-mega {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: var(--bd-bone);
  border: 1px solid var(--rule);
  padding: 24px 32px;
  min-width: 520px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: 0 24px 60px -20px rgba(18, 18, 18, 0.18);
  transition:
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    visibility 0s linear var(--dur);
  z-index: 100;
}
.nav-mega::before {
  /* hover bridge between trigger and panel */
  content: '';
  position: absolute;
  top: -18px;
  left: 0;
  right: 0;
  height: 18px;
}
.nav-item-services:hover .nav-mega,
.nav-item-services:focus-within .nav-mega {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition-delay: 0s, 0s, 0s;
}

.nav-mega-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nav-mega-label {
  font-family: var(--f-sans);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 2px;
}
.nav-mega-link {
  font-family: var(--f-serif);
  font-variation-settings: "opsz" 30, "SOFT" 30;
  font-weight: 350;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -0.012em;
  text-transform: lowercase;
  color: var(--bd-ink);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}
.nav-mega-link:hover,
.nav-mega-link[aria-current="page"] {
  color: var(--bd-crimson);
}

/* Active state for top-level nav-link (Work / Journal / About) */
.nav-link[aria-current="page"] {
  opacity: 1;
}

/* On-dark variant of the mega-menu */
.nav.on-dark .nav-mega {
  background: var(--bd-ink);
  border-color: rgba(255, 255, 255, 0.12);
}
.nav.on-dark .nav-mega-link {
  color: rgba(255, 255, 255, 0.92);
}
.nav.on-dark .nav-mega-label {
  color: rgba(255, 255, 255, 0.55);
}

/* Hide mobile-only controls by default */
.nav-toggle { display: none; }
.nav-burger { display: none; }

/* ============ MOBILE NAV (≤900px) ============ */
@media (max-width: 900px) {
  /* Hamburger button */
  .nav-burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    z-index: 70;
    position: relative;
    margin-left: 12px;
  }
  .nav-burger span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--bd-ink);
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  }
  .nav.on-dark .nav-burger span { background: #fff; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }

  /* Drawer */
  .nav-links {
    position: fixed;
    inset: 0;
    background: var(--bd-bone);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 88px 24px 32px;
    gap: 0;
    overflow-y: auto;
    transform: translateY(-100%);
    transition: transform 320ms var(--ease);
    z-index: 55;
  }
  .nav.on-dark .nav-links { background: var(--bd-ink); color: #fff; }
  .nav-toggle:checked ~ .nav-links { transform: translateY(0); }

  /* Items inside drawer */
  .nav-links .nav-link,
  .nav-links .nav-services-trigger {
    display: block !important;
    width: 100%;
    font-size: 14px;
    letter-spacing: 0.16em;
    padding: 18px 0;
    border-bottom: 1px solid var(--rule);
    opacity: 1;
    text-align: left;
  }
  .nav-services-trigger::after { display: none; }

  .nav-item-services {
    display: block;
    width: 100%;
    border-bottom: 1px solid var(--rule);
  }
  .nav-item-services .nav-services-trigger { border-bottom: 0; }

  .nav-mega {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: transparent;
    border: 0;
    padding: 0 0 18px;
    box-shadow: none;
    grid-template-columns: 1fr;
    gap: 18px;
    min-width: 0;
    transition: none;
  }
  .nav-mega::before { display: none; }
  .nav-mega-col { gap: 8px; }
  .nav-mega-label {
    font-size: 9px;
    letter-spacing: 0.26em;
    margin-top: 6px;
  }
  .nav-mega-link {
    font-size: 18px;
    padding: 4px 0;
    white-space: normal;
  }

  .nav-links .btn-red {
    margin-top: 24px;
    width: 100%;
    justify-content: center;
    padding: 16px;
  }

  /* Lock body scroll while drawer open */
  body:has(.nav-toggle:checked) { overflow: hidden; }
}
