/* ------------ Section styles ------------- */

/* ========== NAV ========== */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--edge);
  mix-blend-mode: difference;
  color: #ece6d8;
  font-family: var(--sans);
  transition: padding 400ms var(--ease);
}
[dir='rtl'] .nav { font-family: var(--sans-ar); }
.nav.compact { padding-top: 14px; padding-bottom: 14px; }

.nav .brand {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  letter-spacing: -0.01em;
}
[dir='rtl'] .nav .brand { font-family: var(--serif-ar); font-style: normal; }
.nav .brand sup { font-family: var(--mono); font-style: normal; font-size: 9px; margin-left: 4px; opacity: 0.6; vertical-align: super; }

.nav ul { list-style: none; display: flex; gap: 36px; }
.nav ul a {
  font-size: 11px; font-weight: 500; letter-spacing: 0.22em;
  text-transform: uppercase; position: relative; padding-bottom: 3px;
}
[dir='rtl'] .nav ul a { font-family: var(--sans-ar); letter-spacing: 0; text-transform: none; font-size: 13px; }
.nav ul a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform 400ms var(--ease);
}
.nav ul a:hover::after { transform: scaleX(1); }

.nav .lang-toggle {
  display: inline-flex; gap: 2px; align-items: center;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  font-family: var(--mono);
}
.nav .lang-toggle button {
  background: transparent; border: none; color: inherit; cursor: pointer;
  padding: 4px 6px; font: inherit; opacity: 0.5;
  transition: opacity 250ms var(--ease);
}
.nav .lang-toggle button.active { opacity: 1; }
.nav .lang-toggle .sep { opacity: 0.4; }

@media (max-width: 900px) {
  .nav ul { display: none; }
}

/* ========== HERO ========== */
.hero {
  min-height: 100vh;
  padding: calc(var(--edge) + 40px) var(--edge) var(--edge);
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* ---- Hero backdrop (animated) ---- */
.hero-backdrop {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  color: var(--blueprint);
}
.hero > *:not(.hero-backdrop) { position: relative; z-index: 1; }

.hero-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px;
  mask-image: radial-gradient(ellipse at 70% 30%, rgba(0,0,0,0.85), rgba(0,0,0,0.15) 70%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 30%, rgba(0,0,0,0.85), rgba(0,0,0,0.15) 70%);
  animation: heroGridShift 28s linear infinite;
  opacity: 0.9;
}
@keyframes heroGridShift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 48px 48px, 48px 48px; }
}

.hero-rule {
  position: absolute; background: var(--line);
  transform-origin: left center;
  animation: heroRuleDraw 1600ms var(--ease) 200ms both;
}
.hero-rule-h { left: var(--edge); right: var(--edge); top: calc(var(--edge) + 40px); height: 1px; }
.hero-rule-v { top: calc(var(--edge) + 40px); bottom: var(--edge); right: calc(var(--edge) - 2px); width: 1px; transform-origin: top center; animation: heroRuleDrawV 1600ms var(--ease) 400ms both; }
[dir='rtl'] .hero-rule-v { right: auto; left: calc(var(--edge) - 2px); }
@keyframes heroRuleDraw  { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes heroRuleDrawV { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.hero-draft {
  position: absolute;
  right: -6%;
  top: 8%;
  width: min(62vh, 640px);
  height: min(62vh, 640px);
  color: var(--blueprint);
  opacity: 0.28;
  animation: heroDraftFloat 14s ease-in-out infinite alternate;
}
[dir='rtl'] .hero-draft { right: auto; left: -6%; }
.hero-draft-circle {
  transform-origin: 300px 300px;
  animation: heroDraftSpin 70s linear infinite;
}
.hero-draft-circle.d2 { animation-duration: 110s; animation-direction: reverse; }
.hero-draft-path {
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  animation: heroDraftDraw 4200ms var(--ease) 600ms forwards;
}
@keyframes heroDraftSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes heroDraftDraw { to { stroke-dashoffset: 0; } }
@keyframes heroDraftFloat {
  from { transform: translateY(-6px); }
  to   { transform: translateY(8px); }
}

.hero-chip {
  position: absolute;
  padding: 6px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  animation: heroChipIn 900ms var(--ease) both;
}
.chip-a { top: 22%; right: 8%; animation-delay: 900ms; }
.chip-b { top: 50%; right: 4%; animation-delay: 1100ms; }
.chip-c { bottom: 22%; left: 6%; animation-delay: 1300ms; }
[dir='rtl'] .chip-a { right: auto; left: 8%; }
[dir='rtl'] .chip-b { right: auto; left: 4%; }
[dir='rtl'] .chip-c { left: auto; right: 6%; }
[dir='rtl'] .hero-chip { font-family: 'Cairo', sans-serif; letter-spacing: 0; text-transform: none; font-size: 11px; }
@keyframes heroChipIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---- Hero entrance animations ---- */
.hero-anim {
  opacity: 0;
  transform: translateY(24px);
  animation: heroRise 900ms var(--ease) forwards;
  animation-delay: var(--d, 0ms);
}
.hero-title .hero-line {
  display: block;
  position: relative;
  width: fit-content;
  max-width: 100%;
}
.hero-title .hero-line::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0.08em; height: 2px;
  background: var(--blueprint);
  transform: scaleX(0); transform-origin: left center;
  animation: heroUnderline 900ms var(--ease) forwards;
  animation-delay: calc(var(--d, 0ms) + 600ms);
  opacity: 0.5;
}
[dir='rtl'] .hero-title .hero-line::after { transform-origin: right center; }
.hero-title .hero-line.italic::after { display: none; }

@keyframes heroRise {
  to { opacity: 1; transform: none; }
}
@keyframes heroUnderline {
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-anim, .hero-rule, .hero-draft, .hero-draft-path, .hero-chip,
  .hero-grid, .hero-draft-circle {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
}
.hero-meta-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-top: 64px;
}
.hero-meta-top .coords { display: flex; flex-direction: column; gap: 6px; }

.hero-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 54vh;
}
.hero-stage svg.hero-svg {
  width: min(100%, 1200px);
  height: auto;
  max-height: 62vh;
}

.hero-svg-slot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0 8px;
}
.hero-svg-slot svg.hero-svg {
  width: min(100%, 1140px);
  height: auto;
  max-height: 58vh;
  display: block;
}

.hero-title-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
}
.hero-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(56px, 11vw, 190px);
  line-height: 0.9;
  letter-spacing: -0.03em;
}
[dir='rtl'] .hero-title { font-family: var(--serif-ar); letter-spacing: 0; line-height: 1.1; }
.hero-title .amp { font-style: italic; color: var(--blueprint); font-weight: 300; }
.hero-title .amp-mark { font-family: var(--mono); font-size: 0.4em; vertical-align: super; color: var(--ink-mute); }

.hero-caption {
  max-width: 320px;
  text-align: right;
  display: flex; flex-direction: column; gap: 12px;
}

.hero-foot {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.hero-foot .cell { display: flex; flex-direction: column; gap: 6px; }
.hero-foot .cell .num { font-family: var(--serif); font-size: clamp(30px, 3.2vw, 48px); font-weight: 300; letter-spacing: -0.02em; line-height: 1; }
[dir='rtl'] .hero-foot .cell .num { font-family: var(--serif-ar); letter-spacing: 0; }

/* ---- Hero responsive ---- */
@media (max-width: 900px) {
  .hero {
    min-height: auto;
    padding: calc(var(--edge) + 72px) var(--edge) calc(var(--edge) + 20px);
    gap: 28px;
  }
  .hero-meta-top {
    flex-direction: column;
    gap: 14px;
    padding-top: 24px;
  }
  .hero-meta-top .coords { flex-direction: row; gap: 14px; flex-wrap: wrap; }
  .hero-title-row {
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
  }
  .hero-title {
    font-size: clamp(48px, 14vw, 96px);
    line-height: 1;
  }
  [dir='rtl'] .hero-title { line-height: 1.15; }
  .hero-caption {
    max-width: 100%;
    text-align: left;
  }
  [dir='rtl'] .hero-caption { text-align: right; }
  .hero-foot {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 20px;
    padding-top: 20px;
  }
  .hero-foot .cell .num { font-size: clamp(26px, 7vw, 40px); }
  /* tone down decorative backdrop on small screens */
  .hero-draft { width: min(80vw, 420px); height: min(80vw, 420px); opacity: 0.18; top: auto; bottom: -8%; right: -18%; }
  [dir='rtl'] .hero-draft { right: auto; left: -18%; }
  .hero-chip { font-size: 9px; padding: 5px 8px; }
  .chip-a { top: 10%; right: 4%; }
  .chip-b { top: auto; bottom: 36%; right: 2%; }
  .chip-c { bottom: 6%; left: 4%; }
  [dir='rtl'] .chip-a { right: auto; left: 4%; }
  [dir='rtl'] .chip-b { right: auto; left: 2%; }
  [dir='rtl'] .chip-c { left: auto; right: 4%; }
  .hero-rule-h { top: calc(var(--edge) + 60px); }
  .hero-rule-v { display: none; }
  .hero-grid { background-size: 32px 32px, 32px 32px; opacity: 0.55; }
}

@media (max-width: 540px) {
  .hero { padding-top: calc(var(--edge) + 88px); gap: 22px; }
  .hero-title { font-size: clamp(40px, 13vw, 72px); }
  .hero-foot { grid-template-columns: 1fr 1fr; gap: 16px; }
  .hero-chip.chip-b { display: none; }
}

/* ========== SECTION TITLES ========== */
.section-head {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  padding: 120px var(--edge) 60px;
  align-items: start;
}
.section-head .index { display: flex; flex-direction: column; gap: 10px; }
.section-head .lead {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(36px, 4.8vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
[dir='rtl'] .section-head .lead { font-family: var(--serif-ar); letter-spacing: 0; line-height: 1.2; }
.section-head .lead em { font-style: italic; color: var(--blueprint); }

@media (max-width: 800px) {
  .section-head { grid-template-columns: 1fr; padding-top: 80px; }
}

/* ========== ABOUT ========== */
.about {
  padding: 40px var(--edge) 120px;
  display: grid;
  grid-template-columns: 5fr 4fr;
  gap: 80px;
  align-items: start;
}
.about .portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--paper-2);
  overflow: hidden;
  border: 1px solid var(--line);
}
.about .portrait svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.about .portrait .plate {
  position: absolute; left: 20px; bottom: 20px;
  background: var(--paper); border: 1px solid var(--ink);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 2px;
}

.about .body { display: flex; flex-direction: column; gap: 32px; padding-top: 20px; }
.about .body .stanza { font-family: var(--serif); font-size: clamp(22px, 1.9vw, 28px); line-height: 1.4; font-weight: 300; text-wrap: pretty; }
[dir='rtl'] .about .body .stanza { font-family: var(--serif-ar); line-height: 1.8; }
.about .body .stanza em { color: var(--blueprint); font-style: italic; }

.about .ledger {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}
.about .ledger .row {
  display: flex; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  grid-column: 1 / -1;
  font-family: var(--sans); font-size: 12px; letter-spacing: 0.05em;
}
[dir='rtl'] .about .ledger .row { font-family: var(--sans-ar); letter-spacing: 0; }
.about .ledger .row .k { color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.2em; font-size: 10px; }
[dir='rtl'] .about .ledger .row .k { letter-spacing: 0; text-transform: none; }
.about .ledger .row .v { color: var(--ink); }

@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; gap: 40px; }
}

/* ========== PROCESS (scrollytelling) ========== */
.process {
  position: relative;
}
.process .track {
  position: relative;
  /* tall container for scroll duration */
  height: calc(500vh * var(--scroll-speed));
}
.process .pin {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.process .pane-left {
  padding: 80px var(--edge);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  justify-content: space-between;
}
.process .step-counter {
  display: flex; gap: 24px; align-items: baseline;
}
.process .step-counter .big {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(72px, 10vw, 160px); line-height: 0.9; letter-spacing: -0.03em;
  color: var(--blueprint);
}
[dir='rtl'] .process .step-counter .big { font-family: var(--serif-ar); letter-spacing: 0; line-height: 1; }
.process .step-counter .of { font-family: var(--mono); font-size: 12px; color: var(--ink-mute); }

.process .step-text { max-width: 44ch; display: flex; flex-direction: column; gap: 18px; }
.process .step-text h3 { font-size: clamp(26px, 2.6vw, 40px); line-height: 1.1; font-weight: 300; }
.process .step-text h3 em { font-style: italic; color: var(--blueprint); }
[dir='rtl'] .process .step-text h3 { font-family: var(--serif-ar); letter-spacing: 0; }
[dir='rtl'] .process .step-text h3 em { font-style: normal; }
.process .step-text p { font-size: 17px; line-height: 1.55; color: var(--ink-soft); }
[dir='rtl'] .process .step-text p { font-family: var(--serif-ar); line-height: 1.8; }

.process .step-progress {
  display: flex; gap: 6px; margin-top: 24px;
}
.process .step-progress .dot {
  width: 10px; height: 10px; border: 1px solid var(--ink); border-radius: 50%; background: transparent;
  transition: background 300ms var(--ease);
}
.process .step-progress .dot.active { background: var(--ink); }
.process .step-progress .dot.done { background: var(--blueprint); border-color: var(--blueprint); }

.process .pane-right {
  position: relative;
  background:
    linear-gradient(var(--paper-2), var(--paper-2));
  overflow: hidden;
}
.process .canvas-wrap {
  position: absolute; inset: 0;
  display: grid; place-items: center;
}
.process .canvas-wrap svg { width: 92%; height: 92%; }

/* Stage 1 — real photo (transparent bg) */
.stage1-photo-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage1-photo {
  max-width: 86%;
  max-height: 82%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 24px 48px rgba(26,26,26,0.22));
}
.stage1-annotation {
  position: absolute;
  bottom: 20px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.stage1-tag {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--blueprint);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--blueprint);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stage1-tag-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  background: var(--paper);
  padding: 4px 10px;
  border: 1px solid var(--line);
}

.process .blueprint-bg {
  position: absolute; inset: 0; opacity: 0.25;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 24px 24px;
}

@media (max-width: 900px) {
  .process .pin { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .process .pane-left { padding: 40px var(--edge) 20px; border-right: none; border-bottom: 1px solid var(--line); }
  .process .track { height: calc(600vh * var(--scroll-speed)); }
}

/* ========== EXPERTISE ========== */
.expertise {
  padding: 40px var(--edge) 120px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}
.expertise .softwares {
  grid-column: 1 / span 12;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 40px;
  border-top: 1px solid var(--line);
}
.expertise .software-card {
  padding: 40px 40px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 20px;
  position: relative;
  overflow: hidden;
  min-height: 300px;
}
.expertise .software-card:last-child { border-right: none; }
.expertise .software-card .sw-name { font-family: var(--serif); font-weight: 300; font-size: clamp(36px, 4vw, 56px); letter-spacing: -0.02em; line-height: 1; }
[dir='rtl'] .expertise .software-card .sw-name { font-family: var(--serif-ar); letter-spacing: 0; }
.expertise .software-card .sw-role { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.18em; }
[dir='rtl'] .expertise .software-card .sw-role { font-family: var(--sans-ar); letter-spacing: 0; text-transform: none; font-size: 12px; }
.expertise .software-card .sw-years { position: absolute; right: 40px; top: 40px; font-family: var(--serif); font-size: 14px; color: var(--ink-mute); }
[dir='rtl'] .expertise .software-card .sw-years { font-family: var(--serif-ar); right: auto; left: 40px; }
.expertise .software-card .sw-years em { font-style: italic; color: var(--blueprint); font-size: 22px; }
.expertise .software-card .sw-bars { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.expertise .software-card .sw-bar { display: grid; grid-template-columns: 120px 1fr 40px; gap: 12px; align-items: center; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--ink-mute); text-transform: uppercase; }
[dir='rtl'] .expertise .software-card .sw-bar { font-family: var(--sans-ar); letter-spacing: 0; text-transform: none; font-size: 11px; }
.expertise .software-card .sw-bar .track { height: 1px; background: var(--line); position: relative; }
.expertise .software-card .sw-bar .fill { position: absolute; left: 0; top: -1px; height: 3px; background: var(--blueprint); }

.expertise .joinery-title {
  grid-column: 1 / span 12;
  display: grid; grid-template-columns: 1fr 2fr; gap: 40px;
  padding-bottom: 32px;
}
.expertise .joinery-title .lead {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(28px, 3vw, 44px); line-height: 1.1; letter-spacing: -0.02em;
}
[dir='rtl'] .expertise .joinery-title .lead { font-family: var(--serif-ar); letter-spacing: 0; line-height: 1.3; }
.expertise .joinery-title .lead em { color: var(--blueprint); font-style: italic; }

.expertise .joinery-grid {
  grid-column: 1 / span 12;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.expertise .joinery-card {
  padding: 28px 24px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 18px;
  min-height: 280px;
  background: var(--paper);
  transition: background 400ms var(--ease);
}
.expertise .joinery-card:hover { background: var(--paper-2); }
.expertise .joinery-card .j-svg { height: 120px; display: grid; place-items: center; }
.expertise .joinery-card .j-svg svg { height: 100%; width: auto; }
.expertise .joinery-card h4 { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.2; letter-spacing: -0.01em; }
[dir='rtl'] .expertise .joinery-card h4 { font-family: var(--serif-ar); letter-spacing: 0; }
.expertise .joinery-card .j-body { font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
[dir='rtl'] .expertise .joinery-card .j-body { font-family: var(--serif-ar); line-height: 1.75; }
.expertise .joinery-card .j-num { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); letter-spacing: 0.2em; }
[dir='rtl'] .expertise .joinery-card .j-num { font-family: var(--sans-ar); letter-spacing: 0; }

@media (max-width: 900px) {
  .expertise .softwares { grid-template-columns: 1fr; }
  .expertise .software-card { border-right: none; }
  .expertise .joinery-grid { grid-template-columns: repeat(2, 1fr); }
  .expertise .joinery-title { grid-template-columns: 1fr; }
}

/* ========== PROJECTS ========== */
.projects {
  padding: 40px 0 120px;
}
.projects .p-head {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
  padding: 0 var(--edge) 60px;
}
.projects .filters {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-self: end; align-self: end;
}
.projects .filters button {
  font-family: var(--sans); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 8px 14px;
  background: transparent; border: 1px solid var(--line); color: var(--ink-mute);
  cursor: pointer; transition: all 300ms var(--ease);
  border-radius: 0;
}
[dir='rtl'] .projects .filters button { font-family: var(--sans-ar); letter-spacing: 0; text-transform: none; }
.projects .filters button:hover { border-color: var(--ink); color: var(--ink); }
.projects .filters button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.projects .grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  padding: 0 var(--edge);
}
.projects .card {
  position: relative;
  background: var(--paper-2);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: opacity 400ms var(--ease);
}
.projects .card.hide { display: none; }
.projects .card .media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; }
.projects .card .media svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.projects .card .media .blueprint-layer {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 600ms var(--ease);
  background: var(--blueprint-ink);
}
.projects .card:hover .blueprint-layer { opacity: 1; }
.projects .card .media .blueprint-layer svg * {
  stroke: #7dc4e0; fill: none; stroke-width: 1;
}
.projects .card .caption {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 18px 20px; border-top: 1px solid var(--line);
}
.projects .card .caption .name { font-family: var(--serif); font-weight: 300; font-size: 22px; letter-spacing: -0.01em; }
.projects .card .caption .name em { font-style: italic; color: var(--blueprint); }
[dir='rtl'] .projects .card .caption .name { font-family: var(--serif-ar); letter-spacing: 0; }
[dir='rtl'] .projects .card .caption .name em { font-style: normal; }
.projects .card .caption .meta { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--ink-mute); text-transform: uppercase; text-align: right; }
[dir='rtl'] .projects .card .caption .meta { font-family: var(--sans-ar); letter-spacing: 0; text-transform: none; text-align: left; }

.projects .card.large { grid-column: span 8; }
.projects .card.medium { grid-column: span 6; }
.projects .card.small { grid-column: span 4; }

@media (max-width: 900px) {
  .projects .p-head { grid-template-columns: 1fr; }
  .projects .filters { justify-self: start; }
  .projects .card.large, .projects .card.medium, .projects .card.small { grid-column: span 12; }
}

/* ========== WORKSHOP STRIP ========== */
.workshop {
  padding: 40px 0 120px;
  overflow: hidden;
}
.workshop .marquee {
  display: flex; gap: 24px;
  padding: 40px var(--edge);
  animation: slideStrip 60s linear infinite;
  width: max-content;
}
.workshop .marquee .plate {
  flex: 0 0 auto;
  width: clamp(280px, 28vw, 420px);
  aspect-ratio: 4 / 5;
  background: var(--paper-2);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.workshop .marquee .plate svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.workshop .marquee .plate .label {
  position: absolute; left: 16px; bottom: 16px;
  background: var(--paper); padding: 6px 10px; border: 1px solid var(--ink);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
}
[dir='rtl'] .workshop .marquee .plate .label { font-family: var(--sans-ar); letter-spacing: 0; text-transform: none; font-size: 11px; }

@keyframes slideStrip {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ========== CONTACT ========== */
.contact {
  background: var(--ink);
  color: var(--paper);
  padding: 140px var(--edge) 60px;
  position: relative;
  overflow: hidden;
}
.contact .c-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 80px; align-items: start; }
.contact .c-lead {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(48px, 7vw, 112px); line-height: 1; letter-spacing: -0.03em;
  text-wrap: balance;
}
[dir='rtl'] .contact .c-lead { font-family: var(--serif-ar); letter-spacing: 0; line-height: 1.15; }
.contact .c-lead em { font-style: italic; color: var(--blueprint-2); }
.contact .c-mail {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(22px, 2.4vw, 32px);
  padding-bottom: 6px; border-bottom: 1px solid var(--paper);
  margin-top: 24px;
}
[dir='rtl'] .contact .c-mail { font-family: var(--serif-ar); font-style: normal; }

.contact .c-right { display: flex; flex-direction: column; gap: 32px; padding-top: 12px; }
.contact .c-right .block { display: flex; flex-direction: column; gap: 6px; }
.contact .c-right .block .k { font-family: var(--sans); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; opacity: 0.55; }
[dir='rtl'] .contact .c-right .block .k { font-family: var(--sans-ar); letter-spacing: 0; text-transform: none; }
.contact .c-right .block .v { font-family: var(--serif); font-size: 20px; font-weight: 300; }
[dir='rtl'] .contact .c-right .block .v { font-family: var(--serif-ar); }

.contact .foot {
  margin-top: 120px;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px;
  padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.14);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  opacity: 0.6;
}
[dir='rtl'] .contact .foot { font-family: var(--sans-ar); letter-spacing: 0; text-transform: none; font-size: 11px; }
.contact .foot .right { text-align: right; }
.contact .foot .center { text-align: center; }

@media (max-width: 900px) {
  .contact .c-grid { grid-template-columns: 1fr; gap: 40px; }
  .contact .foot { grid-template-columns: 1fr; gap: 8px; }
  .contact .foot .right, .contact .foot .center { text-align: left; }
}

/* ========== TWEAKS PANEL ========== */
#tweaks {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  background: var(--paper);
  border: 1px solid var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  /* always use LTR layout for the tweaks panel regardless of page direction */
  width: 280px;
  transform: translateX(calc(100% + 40px));
  transition: transform 400ms var(--ease);
  display: none;
}
#tweaks.on { display: block; }
#tweaks.open { transform: none; }
#tweaks .t-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
}
#tweaks .t-head button { background: transparent; border: none; cursor: pointer; font: inherit; color: var(--ink); }
#tweaks .t-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 18px; max-height: 60vh; overflow: auto; }
#tweaks .t-row { display: flex; flex-direction: column; gap: 6px; }
#tweaks .t-row label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-mute); }
#tweaks .t-row .opts { display: flex; gap: 4px; flex-wrap: wrap; }
#tweaks .t-row .opts button {
  flex: 1 0 auto;
  padding: 6px 10px; font-family: var(--sans); font-size: 11px;
  background: transparent; border: 1px solid var(--line); cursor: pointer;
  color: var(--ink-mute);
  transition: all 200ms var(--ease);
}
#tweaks .t-row .opts button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
#tweaks .t-row input[type='range'] { width: 100%; }
#tweaks .t-toggle {
  position: absolute; right: calc(100% + 8px); bottom: 0;
  background: var(--ink); color: var(--paper); border: none;
  writing-mode: vertical-rl;
  padding: 14px 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  cursor: pointer;
}
