/* ============================================================
   Abdullah Saad — Portfolio v2
   Pistachio paper / Espresso ink / Moss accent / Persimmon signal
   Type: Clash Display · Instrument Serif · Satoshi · JetBrains Mono · Caveat
   Signature: annotation layer (notes, arrows, stamps, footnotes)
   ============================================================ */

:root {
  --paper:   #e6e8dd;
  --paper-2: #dce0cd;
  --ink:     #191713;
  --olive:   #22271b;
  --muted:   #6e6c5a;
  --muted-d: #a4a88c;   /* muted on dark */
  --moss:    #4a5d3a;
  --moss-2:  #3c4c2f;
  --signal:  #e8541d;
  --line:    rgba(25, 23, 19, 0.16);
  --line-d:  rgba(230, 232, 221, 0.15);

  --display: "Clash Display", "Arial Narrow", sans-serif;
  --serif:   "Instrument Serif", Georgia, serif;
  --body:    "Satoshi", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  --hand:    "Caveat", "Comic Sans MS", cursive;

  --pad: clamp(20px, 4vw, 64px);
  --ease: cubic-bezier(0.65, 0.05, 0, 1);
  --ease-soft: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--moss); color: var(--paper); }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }

.mono {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- grain ---------- */
.grain {
  position: fixed; inset: -50%; z-index: 60; pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 9s steps(6) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6%, 4%); }
  40% { transform: translate(4%, -6%); }
  60% { transform: translate(-4%, -4%); }
  80% { transform: translate(6%, 6%); }
}

/* ---------- custom cursor ---------- */
.cursor { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.cursor-dot {
  position: absolute; top: 0; left: 0;
  width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
  border-radius: 50%; background: var(--signal);
}
.cursor-ring {
  position: absolute; top: 0; left: 0;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1px solid var(--signal); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: width 0.35s var(--ease), height 0.35s var(--ease),
              margin 0.35s var(--ease), background-color 0.35s var(--ease),
              opacity 0.25s;
}
.cursor-label {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--paper);
  opacity: 0; transition: opacity 0.2s;
}
.cursor.is-view .cursor-ring {
  width: 76px; height: 76px; margin: -38px 0 0 -38px;
  background: var(--moss); border-color: var(--moss);
}
.cursor.is-view .cursor-label { opacity: 1; }
.cursor.is-view .cursor-dot { opacity: 0; }
.cursor.is-hidden { opacity: 0; }
@media (hover: none), (pointer: coarse) {
  .cursor { display: none; }
}

/* ---------- annotation layer ---------- */
.note {
  font-family: var(--hand);
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--moss-2);
  transform: rotate(-2.5deg);
  display: inline-block;
  pointer-events: none;
}
.note.on-dark { color: var(--muted-d); }
.note.signal { color: var(--signal); }
.note-arrow {
  display: block; width: 44px; height: 30px;
  stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round;
}
.asterisk-note { transform: rotate(2deg); }

/* footnote refs + resolution */
.fn { color: var(--signal); font-style: normal; cursor: help; }
.footnotes {
  padding: 0 var(--pad);
  margin-top: clamp(40px, 7vh, 80px);
  display: flex; flex-direction: column; gap: 8px;
}
.footnotes p {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.05em;
  color: var(--muted-d);
}
.footnotes p b { color: var(--signal); font-weight: 400; }

/* rubber stamps */
.stamp {
  position: absolute; z-index: 3;
  top: 14px; right: 14px;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--signal);
  border: 2px solid var(--signal); border-radius: 3px;
  padding: 6px 10px 5px;
  transform: rotate(6deg);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0.18'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23r)'/%3E%3C/svg%3E");
  transition: transform 0.35s var(--ease);
}
.tile:hover .stamp { transform: rotate(2deg) scale(1.06); }

/* ---------- 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(--pad);
  mix-blend-mode: difference; color: #e6e8dd;
  transition: padding 0.35s var(--ease-soft), background 0.35s var(--ease-soft),
              backdrop-filter 0.35s var(--ease-soft), color 0.35s var(--ease-soft),
              border-color 0.35s var(--ease-soft);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  mix-blend-mode: normal;
  color: var(--ink);
  background: rgba(230, 232, 221, 0.82);
  backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--line);
  padding-top: 14px; padding-bottom: 14px;
}
.nav a { display: inline-block; }
.nav-sig {
  font-family: var(--display); font-weight: 600; font-size: 0.95rem;
  letter-spacing: 0.04em;
}
.nav-sig sup { font-size: 0.55em; margin-left: 2px; }
.nav-links { display: flex; gap: clamp(16px, 3vw, 36px); }
.nav-links a {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; position: relative; padding: 4px 0;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-time { opacity: 0.7; }
@media (max-width: 720px) {
  .nav-time { display: none; }
  .nav-links a:nth-child(3), .nav-links a:nth-child(4) { display: none; }
}

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 96px var(--pad) 48px;
  position: relative;
}
.hero-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; margin-bottom: clamp(24px, 4vh, 56px);
}
.hero-meta { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.hero-status span {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px;
}
.hero-status.reveal-line > span { display: inline-flex; }
.pulse {
  display: inline-block; flex-shrink: 0;
  width: 7px; height: 7px; border-radius: 50%; background: var(--signal);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(232, 84, 29, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(232, 84, 29, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 84, 29, 0); }
}

.hero-name {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(3.2rem, 11.8vw, 10.8rem);
  line-height: 0.86; letter-spacing: -0.025em;
  text-transform: uppercase;
  position: relative;
}
.hn-row { display: block; }
.hn-row-2 { display: flex; align-items: baseline; gap: clamp(20px, 4vw, 64px); flex-wrap: wrap; }
.hn-line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hn-inner { display: inline-block; }
.hn-mark {
  color: var(--signal); font-weight: 500;
  background: none; border: none; cursor: pointer;
  font: inherit; padding: 0 0.14em; line-height: inherit;
  display: inline-block; vertical-align: baseline;
}
/* transform the inner glyph, not the button: the button's hit area stays put
   so hovering it can't scale the target out from under the cursor (no flicker). */
.hn-mark-g {
  display: inline-block;
  transition: transform 0.4s var(--ease);
}
.hn-mark:hover .hn-mark-g { transform: rotate(90deg) scale(1.06); }
.hn-role {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.15rem, 2.6vw, 2rem); line-height: 1.15;
  letter-spacing: 0; text-transform: none; color: var(--ink);
}
.hero-note {
  position: absolute; right: clamp(0px, 4vw, 60px); top: -1.2em;
  text-transform: none; letter-spacing: 0;
}
@media (max-width: 900px) { .hero-note { display: none; } }

.hero-bottom {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 40px; margin-top: clamp(28px, 5vh, 64px);
}
.hero-lead {
  max-width: 560px;
  font-size: clamp(1.05rem, 1.9vw, 1.3rem); line-height: 1.5;
  color: var(--ink);
}
.hero-lead em { color: var(--moss); }

.hero-badge {
  position: relative; flex-shrink: 0;
  width: clamp(96px, 11vw, 132px); height: clamp(96px, 11vw, 132px);
  display: grid; place-items: center;
}
.badge-svg { position: absolute; inset: 0; animation: spin 14s linear infinite; }
.badge-text {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.02em;
  fill: var(--ink); text-transform: uppercase;
}
.badge-arrow {
  font-size: 1.5rem; color: var(--signal);
  transition: transform 0.35s var(--ease);
}
.hero-badge:hover .badge-arrow { transform: translate(4px, -4px); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .hero-top { flex-direction: column; gap: 14px; }
  .hero-bottom { flex-direction: column; align-items: flex-start; }
  .hero-badge { align-self: flex-end; margin-top: -24px; }
}

.hero-scroll {
  display: flex; align-items: center; gap: 12px; color: var(--muted);
  margin-top: clamp(20px, 4vh, 44px);
}
.hs-line {
  width: 48px; height: 1px; background: var(--muted); display: inline-block;
  transform-origin: left; animation: hsline 2.4s var(--ease) infinite;
}
@keyframes hsline {
  0% { transform: scaleX(0); }
  55% { transform: scaleX(1); }
  100% { transform: scaleX(1); opacity: 0; }
}

/* reveal-on-load lines */
.reveal-line { display: block; overflow: hidden; }
.reveal-line > span, .reveal-line > * { display: inline-block; }
.js .reveal-line > *,
.js .hn-inner { transform: translateY(115%); }
.js.loaded .reveal-line > *,
.js.loaded .hn-inner {
  transform: translateY(0);
  transition: transform 1s var(--ease);
}
.js.loaded .hn-row:nth-child(1) .hn-inner { transition-delay: 0.10s; }
.js.loaded .hn-row-2 .hn-inner            { transition-delay: 0.18s; }
.js.loaded .hn-role > *                   { transition-delay: 0.32s; }
.js.loaded .hero-meta .reveal-line:nth-child(1) > * { transition-delay: 0.40s; }
.js.loaded .hero-meta .reveal-line:nth-child(2) > * { transition-delay: 0.46s; }
.js.loaded .hero-status > *               { transition-delay: 0.52s; }
.js.loaded .hero-lead > *                 { transition-delay: 0.44s; }

/* ---------- marquee ---------- */
.marquee {
  background: var(--olive); color: var(--paper);
  overflow: hidden; padding: 16px 0;
}
.marquee-track {
  display: flex; width: max-content;
  animation: marquee 26s linear infinite;
}
.marquee-track span {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(0.95rem, 1.6vw, 1.25rem);
  text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap; padding-right: 12px;
}
.marquee-track i { font-style: normal; color: var(--signal); padding: 0 10px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- section head ---------- */
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 24px; flex-wrap: wrap;
  padding: 0 var(--pad); margin-bottom: clamp(36px, 6vh, 72px);
  position: relative;
}
.sh-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  line-height: 1; letter-spacing: -0.02em; text-transform: uppercase;
}
.sh-title em { text-transform: none; letter-spacing: 0; font-weight: 400; }
.sh-num {
  color: var(--moss); vertical-align: super;
  font-size: clamp(0.75rem, 1.4vw, 1rem); margin-right: 14px;
}
.sh-note { color: var(--muted); }
.sh-note a { border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: color 0.25s, border-color 0.25s; }
.sh-note a:hover { color: var(--moss); border-color: var(--moss); }

/* ---------- work ---------- */
.work { padding: clamp(72px, 12vh, 140px) 0; }
.work-grid {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: clamp(20px, 3vw, 48px) clamp(16px, 2.4vw, 40px);
  padding: 0 var(--pad);
}
.tile { grid-column: span 5; display: block; position: relative; }
.tile-wide { grid-column: span 7; }
.tile:nth-child(3) { grid-column: 2 / span 5; }
.tile:nth-child(4) { grid-column: 7 / span 6; margin-top: clamp(-40px, -3vw, -16px); }
@media (max-width: 900px) {
  .tile, .tile-wide, .tile:nth-child(3), .tile:nth-child(4) {
    grid-column: 1 / -1; margin-top: 0;
  }
}

.tile-media {
  overflow: hidden; border-radius: 6px; position: relative;
  background: var(--paper-2); border: 1px solid var(--line);
}
.tile-media img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  transform: scale(1.015);
  transition: transform 0.9s var(--ease);
}
.tile:hover .tile-media img { transform: scale(1.06); }

.tile-info { padding: 18px 4px 0; }
.tile-row {
  display: flex; justify-content: space-between; color: var(--muted);
  margin-bottom: 10px;
}
.tile-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem); line-height: 1.05;
  letter-spacing: -0.01em; margin-bottom: 8px;
  transition: color 0.3s var(--ease-soft);
}
.tile:hover .tile-title { color: var(--moss); }
.tile-desc { color: var(--muted); font-size: 0.95rem; max-width: 52ch; margin-bottom: 14px; }
.tile-tags { display: flex; flex-wrap: wrap; gap: 8px; color: var(--ink); }
.tile-tags span {
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
  transition: border-color 0.3s, color 0.3s;
}
.tile:hover .tile-tags span { border-color: rgba(74, 93, 58, 0.55); }
.tile-note {
  position: absolute; z-index: 4;
  left: 22px; bottom: 16%;
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
}
.tile-note .note-arrow { width: 38px; height: 26px; margin-left: 46px; margin-bottom: -4px; }
.tile-note-r {
  left: auto; right: 26px; bottom: 20%;
  transform: rotate(2deg); text-align: right;
}
.tile-note-r .note-arrow { margin-left: 0; margin-right: 40px; transform: scaleX(-1); }

/* ---------- about (dark) ---------- */
.about {
  background: var(--olive); color: var(--paper);
  padding: clamp(80px, 13vh, 150px) 0;
}
.section-head-dark .sh-note { color: var(--muted-d); }
.about-statement {
  padding: 0 var(--pad);
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.5rem, 3.6vw, 2.9rem);
  line-height: 1.22; letter-spacing: -0.01em;
  max-width: 1160px;
}
.about-statement em { color: var(--muted-d); }
.about-statement .u {
  font-style: normal; font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 8' preserveAspectRatio='none'%3E%3Cpath d='M2 6 C 30 2, 60 7, 118 3' fill='none' stroke='%23e8541d' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 0 100%; background-size: 100% 0.28em;
  padding-bottom: 0.14em;
}
.about-statement span { display: block; }
.about-statement span + span { margin-top: 0.8em; }

.about-facts {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--line-d);
  border-top: 1px solid var(--line-d); border-bottom: 1px solid var(--line-d);
  margin-top: clamp(56px, 9vh, 100px);
}
.fact {
  background: var(--olive); padding: clamp(24px, 3vw, 44px) var(--pad);
  display: flex; flex-direction: column; gap: 10px;
}
.fact-n {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.2rem, 4.5vw, 3.8rem); line-height: 1; color: var(--paper);
}
.fact-l { color: var(--muted-d); }
@media (max-width: 860px) { .about-facts { grid-template-columns: repeat(2, 1fr); } }

/* ---------- services ---------- */
.services { padding: clamp(72px, 12vh, 140px) 0 clamp(48px, 8vh, 100px); }
.service-list { border-top: 1px solid var(--line); }
.service {
  position: relative;
  display: grid;
  grid-template-columns: minmax(56px, 120px) 1fr minmax(0, 460px) 60px;
  align-items: center; gap: clamp(12px, 2vw, 32px);
  padding: clamp(24px, 3.4vw, 44px) var(--pad);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.service::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: var(--olive);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform 0.5s var(--ease);
}
.service:hover::before { transform: scaleY(1); transform-origin: top; }
.service > * { position: relative; z-index: 1; }
.sv-num { color: var(--moss); }
.service:hover .sv-num { color: var(--muted-d); }
.sv-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.4rem, 3.2vw, 2.6rem); line-height: 1.05;
  letter-spacing: -0.015em; text-transform: uppercase;
  transition: color 0.35s var(--ease-soft), transform 0.5s var(--ease);
}
.sv-desc {
  color: var(--muted); font-size: 0.95rem;
  transition: color 0.35s var(--ease-soft);
}
.sv-arrow {
  font-size: 1.4rem; justify-self: end; color: var(--ink);
  transform: translateX(-8px); opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.3s, color 0.35s;
}
.service:hover .sv-title { color: var(--paper); transform: translateX(10px); }
.service:hover .sv-desc { color: var(--muted-d); }
.service:hover .sv-arrow { color: var(--signal); transform: translateX(0); opacity: 1; }
.sv-note { position: absolute; right: var(--pad); top: 8px; z-index: 2; }
@media (max-width: 860px) {
  .service { grid-template-columns: 48px 1fr 40px; }
  .sv-desc { grid-column: 2 / -1; grid-row: 2; }
  .sv-note { display: none; }
}

/* ---------- writing strip ---------- */
.writing { padding: 0 0 clamp(72px, 12vh, 140px); }
.post-list { border-top: 1px solid var(--line); }
.post {
  display: grid; grid-template-columns: minmax(120px, 220px) 1fr 60px;
  align-items: center; gap: clamp(12px, 2vw, 32px);
  padding: clamp(20px, 2.6vw, 34px) var(--pad);
  border-bottom: 1px solid var(--line);
  transition: background 0.35s var(--ease-soft);
}
.post:hover { background: var(--paper-2); }
.post-tag { color: var(--muted); }
.post-title {
  font-family: var(--body); font-weight: 500;
  font-size: clamp(1.02rem, 1.8vw, 1.3rem); line-height: 1.35;
  max-width: 62ch;
  transition: color 0.3s;
}
.post:hover .post-title { color: var(--moss); }
.post-arrow {
  justify-self: end; font-size: 1.2rem;
  transition: transform 0.35s var(--ease);
}
.post:hover .post-arrow { transform: translate(4px, -4px); color: var(--moss); }
@media (max-width: 720px) {
  .post { grid-template-columns: 1fr 40px; }
  .post-tag { grid-column: 1 / -1; }
}

/* ---------- contact ---------- */
.contact {
  background: var(--olive); color: var(--paper);
  padding: clamp(80px, 14vh, 160px) var(--pad) 0;
  position: relative;
}
.contact-kicker { color: var(--muted-d); margin-bottom: 24px; }
.contact-mail { display: block; }
.cm-line { display: block; overflow: hidden; padding-bottom: 0.08em; }
.cm-inner {
  display: inline-block;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(3.4rem, 13vw, 12rem);
  line-height: 0.9; letter-spacing: -0.025em; text-transform: uppercase;
  transition: color 0.4s var(--ease-soft);
}
.cm-inner em { color: var(--muted-d); text-transform: none; letter-spacing: 0; transition: color 0.4s var(--ease-soft); }
.contact-mail:hover .cm-inner { color: var(--muted-d); }
.contact-mail:hover .cm-inner em { color: var(--paper); }
.cm-mailrow {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 26px; color: var(--paper);
  border-bottom: 1px solid var(--line-d); padding-bottom: 8px;
  font-size: 0.85rem; letter-spacing: 0.06em; text-transform: none;
  transition: color 0.3s, border-color 0.3s;
}
.cm-arr { transition: transform 0.35s var(--ease); }
.contact-mail:hover .cm-mailrow { color: var(--signal); border-color: var(--signal); }
.contact-mail:hover .cm-arr { transform: translate(4px, -4px); }
.contact-note { position: absolute; right: var(--pad); top: clamp(70px, 12vh, 140px); }
@media (max-width: 900px) { .contact-note { display: none; } }

.contact-links {
  display: flex; flex-wrap: wrap; gap: 14px 36px;
  margin-top: clamp(48px, 8vh, 88px);
}
.contact-links a {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-d);
  position: relative; padding: 6px 0;
  transition: color 0.3s;
}
.contact-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: var(--signal);
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.contact-links a:hover { color: var(--paper); }
.contact-links a:hover::after { transform: scaleX(1); transform-origin: left; }

.footer-bar {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px 24px;
  color: var(--muted-d);
  border-top: 1px solid var(--line-d);
  margin-top: clamp(28px, 5vh, 48px);
  padding: 26px 0 30px;
}
.footer-bar .egg-hint { cursor: pointer; transition: color 0.3s; }
.footer-bar .egg-hint:hover { color: var(--signal); }

/* ---------- scroll reveals ---------- */
.js .rv { opacity: 0; transform: translateY(28px); }
.js .rv.in {
  opacity: 1; transform: none;
  transition: opacity 0.85s var(--ease-soft), transform 0.85s var(--ease);
}
.js .rv.in:nth-child(2) { transition-delay: 0.08s; }
.js .rv.in:nth-child(3) { transition-delay: 0.16s; }
.js .rv.in:nth-child(4) { transition-delay: 0.24s; }

.js .tile { opacity: 0; transform: translateY(44px); }
.js .tile.in {
  opacity: 1; transform: none;
  transition: opacity 0.9s var(--ease-soft), transform 0.9s var(--ease);
}

/* ============================================================
   SAAD.SYS — terminal easter egg
   ============================================================ */
.term {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(10px, 3vw, 40px);
  background: rgba(20, 22, 14, 0.82);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease-soft);
}
.term.open { opacity: 1; pointer-events: auto; }
.term-win {
  width: min(880px, 100%); height: min(600px, 86svh);
  background: #101408;
  border: 1px solid rgba(164, 168, 140, 0.3);
  border-radius: 8px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(24px) scale(0.98);
  transition: transform 0.35s var(--ease);
  position: relative;
}
.term.open .term-win { transform: none; }
.term-win::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(
    0deg, rgba(220, 232, 190, 0.04) 0 1px, transparent 1px 3px
  );
}
.term-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(164, 168, 140, 0.08);
  border-bottom: 1px solid rgba(164, 168, 140, 0.18);
  flex-shrink: 0;
}
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.term-dots i:nth-child(1) { background: #e8541d; }
.term-dots i:nth-child(2) { background: #c9a53f; }
.term-dots i:nth-child(3) { background: #6f8f4f; }
.term-title {
  flex: 1; text-align: center;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: #a4a88c;
}
.term-close {
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 0.8rem; color: #a4a88c;
  padding: 2px 6px;
}
.term-close:hover { color: #e8541d; }
.term-body {
  flex: 1; overflow-y: auto;
  padding: 18px 18px 8px;
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.65;
  color: #ccd8ac;
}
.term-body::-webkit-scrollbar { width: 8px; }
.term-body::-webkit-scrollbar-thumb { background: rgba(164,168,140,0.3); border-radius: 4px; }
.term-body .t-dim  { color: #7c8266; }
.term-body .t-ok   { color: #9db87f; }
.term-body .t-hot  { color: #ff7a45; }
.term-body .t-head { color: #e6e8dd; }
.term-body a { color: #9db87f; text-decoration: underline; text-underline-offset: 3px; }
.term-body a:hover { color: #ff7a45; }
.term-body pre {
  font: inherit; white-space: pre-wrap; word-break: break-word;
  margin: 0 0 2px;
}
.term-inrow {
  display: flex; gap: 8px; align-items: baseline;
  padding: 4px 18px 16px; flex-shrink: 0;
}
.term-prompt { font-family: var(--mono); font-size: 0.82rem; color: #9db87f; white-space: nowrap; }
.term-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--mono); font-size: 0.82rem; color: #e6e8dd;
  caret-color: #ff7a45;
}

/* rm -rf gag: what the page looks like when css/style.css "gets removed" */
.rm-nuked, .rm-nuked * {
  font-family: "Times New Roman", Times, serif !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  color: #000 !important;
  background: #fff !important;
  border-color: #767676 !important;
  border-radius: 0 !important;
  animation: none !important;
}
.rm-nuked a { text-decoration: underline !important; color: #0000ee !important; }

/* ============================================================
   Subpages: case studies, writing index, 404
   ============================================================ */
.page { padding: 140px var(--pad) 0; max-width: 1160px; margin: 0 auto; }
.page-back {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  display: inline-flex; gap: 8px; margin-bottom: 40px;
  transition: color 0.25s;
}
.page-back:hover { color: var(--moss); }
.cs-kicker { color: var(--moss); margin-bottom: 18px; }
.cs-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  line-height: 0.95; letter-spacing: -0.02em; text-transform: uppercase;
  margin-bottom: 12px;
}
.cs-title em { text-transform: none; font-weight: 400; }
.cs-sub { font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: var(--muted); max-width: 640px; }

.cs-meta {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  margin: clamp(36px, 6vh, 64px) 0;
}
.cs-meta div { background: var(--paper); padding: 18px 20px; }
.cs-meta .k { display: block; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.cs-meta .v { font-weight: 500; font-size: 0.95rem; }
.cs-meta .v a { color: var(--moss); border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .cs-meta { grid-template-columns: repeat(2, 1fr); } }

.cs-plate { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: clamp(40px, 7vh, 80px); }
.cs-plate img { width: 100%; }

.cs-section { display: grid; grid-template-columns: 220px 1fr; gap: 32px; padding: clamp(28px, 4vh, 48px) 0; border-top: 1px solid var(--line); }
.cs-section h2 { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--moss); font-weight: 400; padding-top: 6px; }
.cs-section > div { max-width: 640px; }
.cs-section p { margin-bottom: 16px; color: #33312a; }
.cs-section p:last-child { margin-bottom: 0; }
.cs-section p b { font-weight: 600; color: var(--ink); }
.cs-section ul { list-style: none; }
.cs-section li { padding: 7px 0 7px 24px; position: relative; color: #33312a; }
.cs-section li::before { content: "→"; position: absolute; left: 0; color: var(--moss); }
@media (max-width: 720px) { .cs-section { grid-template-columns: 1fr; gap: 12px; } }

.cs-nav {
  display: flex; justify-content: space-between; gap: 20px;
  border-top: 1px solid var(--line);
  padding: clamp(28px, 4vh, 48px) 0 clamp(60px, 9vh, 110px);
}
.cs-nav a { font-family: var(--display); font-weight: 600; font-size: clamp(1.1rem, 2.4vw, 1.7rem); text-transform: uppercase; letter-spacing: -0.01em; transition: color 0.25s; }
.cs-nav a:hover { color: var(--moss); }
.cs-nav .lbl { display: block; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 8px; }

/* writing index */
.wi-head { margin-bottom: clamp(36px, 6vh, 64px); }
.wi-title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 6rem); line-height: 0.95;
  letter-spacing: -0.02em; text-transform: uppercase;
}
.wi-title em { text-transform: none; font-weight: 400; }
.wi-sub { color: var(--muted); margin-top: 14px; max-width: 560px; }
.wi-list { border-top: 1px solid var(--line); margin: 0 calc(-1 * var(--pad)); padding-bottom: clamp(60px, 9vh, 110px); }

/* 404 */
.nf {
  min-height: 100svh; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center;
  padding: 0 var(--pad); position: relative;
}
.nf-code {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(6rem, 24vw, 20rem); line-height: 0.9; letter-spacing: -0.03em;
}
.nf-code i { font-style: normal; color: var(--signal); }
.nf-msg { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); margin: 24px 0 36px; max-width: 480px; line-height: 1.8; }
.nf-msg .t-ok { color: var(--moss); }
.nf-home {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.1em;
  text-transform: uppercase; border: 1px solid var(--line); border-radius: 999px;
  padding: 13px 24px; transition: border-color 0.3s, color 0.3s;
}
.nf-home:hover { border-color: var(--moss); color: var(--moss); }

/* ---------- motion off ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
  .js .rv, .js .tile, .js .reveal-line > *, .js .hn-inner {
    opacity: 1 !important; transform: none !important;
  }
  .cursor { display: none; }
}
