/* Home page, ASCII edition. Monospace grid: widths in ch, rhythm in --lh. */

/* Same Geist Mono file the hero frames were baked against (assets/ascii). */
@font-face {
  font-family: "Geist Mono";
  src: url("../assets/fonts/GeistMono-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0a0908;
  --bg-2: #12110e;
  --ink: #ece6d6;
  --ink-2: #a8a293;
  --ink-3: #6e695e;
  --rule: rgba(236, 230, 214, 0.14);
  --rule-2: rgba(236, 230, 214, 0.28);
  --accent: #facf0f;
  --accent-soft: rgba(250, 207, 15, 0.55);
  --bg-rgb: 10, 9, 8;
  --fs: 15px;
  --lh: 24px;
  --gutter: 3ch;
  --mono: "Geist Mono", "Geeza Pro", "Noto Naskh Arabic", ui-monospace, "SF Mono", Menlo, monospace;
}
/* Light theme: paper and ink. assets/theme.js sets data-theme from the visitor's clock or choice. */
:root[data-theme="light"] {
  --bg: #f3efe6;
  --bg-2: #ebe6da;
  --ink: #1b1a17;
  --ink-2: #46433c;
  --ink-3: #6f6a61;
  --rule: rgba(27, 26, 23, 0.14);
  --rule-2: rgba(27, 26, 23, 0.3);
  --accent: #7a5c00;
  --accent-soft: rgba(122, 92, 0, 0.62);
  --mark: rgba(250, 207, 15, 0.5);
  --bg-rgb: 243, 239, 230;
  color-scheme: light;
}
:root { color-scheme: dark; --mark: rgba(250, 207, 15, 0.16); }
/* Dark text on paper: macOS's thin "antialiased" smoothing washes it out, so use the normal one. */
:root[data-theme="light"] body { -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; }

/* Highlighter on the few facts worth catching on a skim: a marker band under the lower half of
   the line on paper, a faint one in the dark. Clone keeps the band on every wrapped line. */
mark.hl {
  color: var(--ink); font-weight: 500;
  background: linear-gradient(to bottom, transparent 56%, var(--mark) 56%, var(--mark) 92%, transparent 92%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  padding: 0 .25ch; margin: 0 -.25ch;
}

/* Theme control in the header (added by assets/theme.js): one click flips light and dark. */
.header nav { display: flex; align-items: center; gap: 3ch; }
.theme-switch { background: transparent; border: 1px solid var(--rule-2); color: var(--ink); font: inherit; font-size: 12px; padding: 2px 1ch; cursor: pointer; white-space: nowrap; transition: border-color .2s; }
.theme-switch:hover { border-color: var(--ink); }
.theme-switch__auto { color: var(--ink-3); margin-left: .4ch; }
.theme-switch--float { position: fixed; top: 16px; right: 16px; z-index: 30; background: var(--bg); }
@media (max-width: 760px) { .header nav { gap: 1ch; } }


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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--fs);
  line-height: var(--lh);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
p, ul, h1, h2, h3, h4, figure { margin: 0; }
ul { padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--bg); }

.link { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-soft); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: color .2s, text-decoration-color .2s; }
.link:hover, .link:focus-visible { color: var(--accent); text-decoration-color: var(--accent); }

.wrap { width: 100%; max-width: 1168px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- header ---------- */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  transition: transform .3s ease, background-color .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.header.is-solid { background: rgba(var(--bg-rgb),  0.92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-bottom-color: var(--rule); }
.header--hidden { transform: translateY(-100%); }
.header__content { display: flex; align-items: center; justify-content: space-between; height: calc(var(--lh) * 3); }
.header__logo-container { display: flex; align-items: center; gap: 1.5ch; cursor: pointer; text-decoration: none; }
.header__logo-img-cont { width: 36px; height: 36px; overflow: hidden; border-radius: 50%; border: 1px solid var(--rule-2); }
.header__logo-img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.header__logo-sub { font-size: 13px; letter-spacing: .02em; color: var(--ink); }
.header__links { display: flex; gap: 3ch; font-size: 13px; }
.header__link { color: var(--ink-2); text-decoration: none; text-transform: lowercase; transition: color .2s; }
.header__link::before { content: "["; opacity: 0; margin-right: .4ch; transition: opacity .2s; color: var(--ink-3); }
.header__link::after { content: "]"; opacity: 0; margin-left: .4ch; transition: opacity .2s; color: var(--ink-3); }
.header__link:hover, .header__link[aria-current="page"] { color: var(--ink); }
.header__link:hover::before, .header__link:hover::after,
.header__link[aria-current="page"]::before, .header__link[aria-current="page"]::after { opacity: 1; }
.header__link--ar { font-size: 16px; }
.header__menu-btn { display: none; background: none; border: 1px solid var(--rule-2); color: var(--ink); font: inherit; font-size: 12px; padding: 2px 1ch; cursor: pointer; }
.header__sm-menu { display: none; }

@media (max-width: 760px) {
  .header__links { display: none; }
  .header__menu-btn { display: block; }
  .header__sm-menu { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--rule); padding: var(--lh) var(--gutter); }
  .header__sm-menu--active { display: block; }
  .header__sm-menu-links { display: grid; gap: calc(var(--lh) / 2); }
  .header__sm-menu-link a { text-decoration: none; color: var(--ink); text-transform: lowercase; }
  .header__sm-menu-link a::before { content: "> "; color: var(--ink-3); }
}

/* ---------- hero ---------- */
.home-hero { position: relative; height: 100vh; height: 100svh; min-height: 400px; overflow: hidden; background: var(--bg); contain: strict; }
.ascii-hero__stage { position: absolute; inset: 0; overflow: hidden; }
.ascii-hero__frame {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  margin: 0; white-space: pre; font-family: var(--mono); font-weight: 400;
  line-height: 1; letter-spacing: 0; color: var(--hero-ink);
  font-kerning: none; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
  text-rendering: optimizeSpeed; user-select: none;
  opacity: 0; transition: opacity 1.2s ease;
}
/* The picture's glyph colour: the page ink taken 30% of the way to the background, so the finer
   300-column frames sit behind the type instead of competing with it. */
:root { --hero-ink: #a8a498; }
:root[data-theme="light"] { --hero-ink: #5c5a55; }
.home-hero.is-ready .ascii-hero__frame { opacity: .9; }
/* keep the type legible over the moving field */
.ascii-hero__shade { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 62% at 18% 78%, rgba(var(--bg-rgb), .92) 0%, rgba(var(--bg-rgb), .72) 42%, rgba(var(--bg-rgb), 0) 78%),
    linear-gradient(to top, rgba(var(--bg-rgb), 1) 0%, rgba(var(--bg-rgb), 0) 14%),
    linear-gradient(to bottom, rgba(var(--bg-rgb), .94) 0%, rgba(var(--bg-rgb), .6) 8%, rgba(var(--bg-rgb), 0) 20%); }
@media (max-width: 760px) {
  .ascii-hero__shade { background:
    linear-gradient(to top, rgba(var(--bg-rgb), .97) 0%, rgba(var(--bg-rgb), .85) 38%, rgba(var(--bg-rgb), 0) 70%),
    linear-gradient(to bottom, rgba(var(--bg-rgb), .75) 0%, rgba(var(--bg-rgb), 0) 16%); }
}

.ascii-hero__marks span { position: absolute; width: 14px; height: 14px; pointer-events: none; }
.ascii-hero__marks span::before, .ascii-hero__marks span::after { content: ""; position: absolute; background: var(--ink-2); }
.ascii-hero__marks span::before { left: 6px; top: 0; width: 1px; height: 14px; }
.ascii-hero__marks span::after { top: 6px; left: 0; height: 1px; width: 14px; }
.ascii-hero__marks span:nth-child(1) { top: calc(var(--lh) * 3 + 16px); left: 16px; }
.ascii-hero__marks span:nth-child(2) { top: calc(var(--lh) * 3 + 16px); right: 16px; }
.ascii-hero__marks span:nth-child(3) { bottom: 16px; left: 16px; }
.ascii-hero__marks span:nth-child(4) { bottom: 16px; right: 16px; }

.home-hero__content { position: absolute; left: 0; right: 0; bottom: calc(var(--lh) * 3); }
.home-hero__panel { max-width: 64ch; }
.home-hero__label { font-size: 12px; color: var(--ink); letter-spacing: .06em; text-transform: uppercase; margin-bottom: var(--lh); display: flex; align-items: center; gap: 1.5ch; }
.home-hero__label::after { content: ""; width: 12ch; border-top: 1px solid var(--rule-2); }
.heading-primary { font-size: clamp(40px, 7.4vw, 108px); line-height: .95; font-weight: 500; letter-spacing: -0.045em; color: var(--ink); }
.home-hero__info { margin-top: calc(var(--lh) * 1.25); font-size: 15px; color: var(--ink-2); }
.home-hero__info a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; transition: text-decoration-color .2s; }
.home-hero__info a:hover { text-decoration-color: var(--accent); }
/* The page's contents, numbered like its sections. */
.home-hero__toc { display: flex; flex-wrap: wrap; gap: 1ch 3ch; margin-top: calc(var(--lh) * 1.25); font-size: 13px; }
.home-hero__toc a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule-2); padding-bottom: 2px; transition: color .2s, border-color .2s; }
.home-hero__toc b { font-weight: 400; color: var(--ink-3); margin-right: .6ch; }
.home-hero__toc a:hover { color: var(--accent); border-color: var(--accent); }
.home-hero__toc a:first-child::after { content: " \2193"; color: var(--ink-3); }
.home-hero__socials { display: flex; flex-wrap: wrap; gap: 1ch 3ch; margin-top: calc(var(--lh) * 1.25); font-size: 13px; }
.home-hero__social-icon-link { color: var(--ink-2); text-decoration: none; transition: color .2s; }
.home-hero__social-icon-link::after { content: " \2197"; color: var(--ink-3); }
.home-hero__social-icon-link:hover { color: var(--accent); }

.ascii-hero__meta { position: absolute; right: var(--gutter); bottom: calc(var(--lh) * 3); display: flex; flex-direction: column; align-items: flex-end; gap: calc(var(--lh) / 2); font-size: 12px; color: var(--ink-2); text-align: right; background: rgba(var(--bg-rgb),  0.86); border: 1px solid var(--rule); padding: calc(var(--lh) / 2) 2ch; }
.ascii-hero__clock { font-variant-numeric: tabular-nums; color: var(--ink); }
.home-hero__unmute { background: transparent; color: var(--ink); border: 1px solid var(--rule-2); font: inherit; font-size: 12px; padding: 4px 1.5ch; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.home-hero__unmute::before { content: "[ "; color: var(--ink-3); }
.home-hero__unmute::after { content: " ]"; color: var(--ink-3); }
.home-hero__unmute:hover, .home-hero__unmute[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.home-hero__unmute:hover::before, .home-hero__unmute:hover::after,
.home-hero__unmute[aria-pressed="true"]::before, .home-hero__unmute[aria-pressed="true"]::after { color: var(--bg); }

@media (max-width: 760px) {
  .home-hero__content { bottom: calc(var(--lh) * 4.5); }
  .home-hero__toc { gap: 1ch 2ch; font-size: 12px; }
  .home-hero__toc b { margin-right: .4ch; }
  .home-hero__socials { margin-top: var(--lh); }
  .ascii-hero__meta { left: var(--gutter); right: var(--gutter); bottom: var(--lh); flex-direction: row; justify-content: space-between; align-items: center; }
  .ascii-hero__res { display: none; }
  .ascii-hero__marks span:nth-child(3), .ascii-hero__marks span:nth-child(4) { display: none; }
}

@media (max-height: 520px) {
  .ascii-hero__marks span:nth-child(1), .ascii-hero__marks span:nth-child(2) { display: none; }
}

/* ---------- sections ---------- */
.sec { padding: calc(var(--lh) * 4) 0 calc(var(--lh) * 1.5); }
.sec-label { display: flex; align-items: center; gap: 2ch; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: calc(var(--lh) * 1.5); }
.sec-label::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.sec-label b { color: var(--ink-2); font-weight: 400; }
.heading-sec { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.1; font-weight: 500; letter-spacing: -0.03em; margin-bottom: calc(var(--lh) * 2); }

/* ---------- about ---------- */
.about__content { display: grid; grid-template-columns: minmax(0, 66ch) minmax(0, 1fr); gap: calc(var(--lh) * 2) 6ch; align-items: start; }
.about__content-details { display: grid; gap: var(--lh); color: var(--ink-2); }
.about__content-details em { color: var(--ink); font-style: italic; }
.about__actions { margin-top: calc(var(--lh) * 1.5); }

.btn-ascii { display: inline-flex; align-items: center; gap: 1ch; font: inherit; font-size: 13px; color: var(--ink); text-decoration: none; border: 1px solid var(--rule-2); padding: 6px 2ch; text-transform: lowercase; transition: background .2s, color .2s, border-color .2s; }
.btn-ascii::after { content: "\2192"; color: var(--ink-3); transition: transform .2s, color .2s; }
.btn-ascii:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-ascii:hover::after { color: var(--bg); transform: translateX(3px); }

.box { position: relative; border: 1px solid var(--rule); padding: calc(var(--lh) * 1.25) 3ch; }
.box__tag { position: absolute; top: 0; left: 2ch; transform: translateY(-50%); background: var(--bg); padding: 0 1ch; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.box::before, .box::after { content: "+"; position: absolute; font-size: 13px; line-height: 1; color: var(--ink-3); background: var(--bg); }
.box::before { top: -7px; right: -4px; }
.box::after { bottom: -7px; left: -4px; }

.about__content-title { font-size: 12px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--lh); }
/* Tech stack, grouped by what the tools are for. */
.stack { display: grid; gap: calc(var(--lh) * .6); margin: 0; }
.stack__row { display: grid; grid-template-columns: 10ch minmax(0, 1fr); gap: 0 2ch; align-items: start; }
.stack__label { font-size: 11px; line-height: 24px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.skills { display: flex; flex-wrap: wrap; gap: 8px 1ch; margin: 0; }
@media (max-width: 420px) { .stack__row { grid-template-columns: 1fr; gap: 6px; } }
.skills__skill { font-size: 12px; color: var(--ink-2); border: 1px solid var(--rule); padding: 0 1ch; line-height: 22px; transition: color .2s, border-color .2s; }
.skills__skill:hover { color: var(--ink); border-color: var(--rule-2); }

.about__aside { display: grid; gap: calc(var(--lh) * 2.5); }

/* ---------- reel: linework backdrop behind the top of the work section ---------- */
/* Line roles and opacities follow Plotter's standard (github.com/pasqualevitiello/plotter, MIT). */
.projects { position: relative; isolation: isolate; --reel-h: clamp(380px, 48vw, 720px); padding-top: calc(var(--reel-h) * 0.52); }
.reel { position: absolute; z-index: -1; inset: 0 0 auto; height: var(--reel-h); pointer-events: none; color: var(--ink);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 48%, transparent 96%), linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 48%, transparent 96%), linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
  mask-composite: intersect; }
.reel__svg { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s; stroke: currentColor; }
.reel.is-ready .reel__svg { opacity: .8; }
.reel__svg [data-plotter-role] { stroke-width: 1; }
.reel__svg [data-plotter-role="primary"] { opacity: 1; }
.reel__svg [data-plotter-role="secondary"] { opacity: .32; }
.reel__svg [data-plotter-role="guide"] { opacity: .14; }
.reel__svg [data-plotter-role="hatch"] { opacity: .18; }
@media (max-width: 760px) {
  .projects { --reel-h: 300px; }
}

/* ---------- experience ---------- */
.experience__content { display: grid; gap: calc(var(--lh) * 2); }
.experience__card-header { display: grid; grid-template-columns: 1fr auto; gap: 4px 3ch; margin-bottom: calc(var(--lh) * 1.25); }
.experience__card-title { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
.experience__card-subtitle { color: var(--ink-2); grid-column: 1; }
.experience__card-duration { grid-column: 2; grid-row: 1; text-align: right; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.experience__card-duration--prev { grid-row: 2; color: var(--ink-3); }
.experience__card-body { color: var(--ink-2); display: grid; gap: var(--lh); }
.experience__card-body strong { color: var(--ink); font-weight: 500; }
.tree li { position: relative; padding-left: 4ch; }
.tree li + li { margin-top: calc(var(--lh) / 2); }
/* branch lines drawn in CSS so they stay continuous across wrapped lines */
.tree li::before { content: ""; position: absolute; left: .5ch; top: calc(var(--lh) * -0.5); bottom: calc(var(--lh) * -0.5); border-left: 1px solid var(--ink-3); }
.tree li:first-child::before { top: 0; }
.tree li:last-child::before { bottom: auto; height: calc(var(--lh) * 1); }
.tree li:first-child:last-child::before { height: calc(var(--lh) * .5); }
.tree li::after { content: ""; position: absolute; left: .5ch; top: calc(var(--lh) * .5); width: 2.5ch; border-top: 1px solid var(--ink-3); }
.experience__stack { font-size: 13px; color: var(--ink-3); }
.experience__stack strong { color: var(--ink-2); font-weight: 400; }

/* ---------- work ---------- */
.projects__switcher { display: inline-flex; border: 1px solid var(--rule-2); background: var(--bg); margin-bottom: calc(var(--lh) * 2); }
.projects__switch-btn { background: transparent; border: 0; color: var(--ink-2); font: inherit; font-size: 13px; padding: 6px 2ch; cursor: pointer; text-transform: lowercase; transition: background .2s, color .2s; }
.projects__switch-btn + .projects__switch-btn { border-left: 1px solid var(--rule-2); }
.projects__switch-btn:hover { color: var(--ink); }
.projects__switch-btn--active { background: var(--ink); color: var(--bg); }
.projects__content { display: grid; }
.projects__row { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: calc(var(--lh) * 1.5) 5ch; padding: calc(var(--lh) * 2) 0; border-top: 1px solid var(--rule); align-items: start; }
.projects__row.hidden { display: none; }
.projects__row-img-cont { position: relative; border: 1px solid var(--rule); padding: 10px; background: var(--bg-2); }
.projects__row-img-cont figcaption { position: absolute; top: 0; left: 2ch; transform: translateY(-50%); background: var(--bg); padding: 0 1ch; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.projects__row-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; filter: grayscale(1) contrast(1.04) brightness(.86); transition: filter .5s ease; }
.projects__row:hover .projects__row-img { filter: none; }
.projects__row-index { font-size: 12px; color: var(--ink-3); letter-spacing: .06em; margin-bottom: calc(var(--lh) / 2); }
.projects__row-content-title { font-size: 20px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.3; margin-bottom: var(--lh); }
.projects__row-content-desc { color: var(--ink-2); margin-bottom: calc(var(--lh) * 1.25); }
.projects__row-content-desc strong { display: block; margin-top: calc(var(--lh) / 2); color: var(--ink-3); font-weight: 400; font-size: 13px; }

/* ---------- footer ---------- */
.main-footer { border-top: 1px solid var(--rule); margin-top: calc(var(--lh) * 3); padding: calc(var(--lh) * 3) 0 calc(var(--lh) * 2); color: var(--ink-2); font-size: 13px; }
.main-footer__upper { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--lh) * 2) 6ch; }
.main-footer__heading { font-size: 12px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--lh); }
.main-footer__social-cont { display: flex; flex-wrap: wrap; gap: 1ch 3ch; }
.main-footer__social-cont a { text-decoration: none; color: var(--ink-2); transition: color .2s; }
.main-footer__social-cont a::after { content: " \2197"; color: var(--ink-3); }
.main-footer__social-cont a:hover { color: var(--accent); }
.main-footer__name { color: var(--ink); font-size: 15px; font-weight: 500; margin-bottom: calc(var(--lh) / 2); }
.main-footer__lower { margin-top: calc(var(--lh) * 3); padding-top: var(--lh); border-top: 1px dashed var(--rule); color: var(--ink-3); font-size: 12px; display: flex; justify-content: space-between; gap: 2ch; flex-wrap: wrap; }
.main-footer__lower a { color: var(--ink-2); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .about__content { grid-template-columns: 1fr; }
  .projects__row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --fs: 14px; --lh: 22px; --gutter: 16px; }
  .sec { padding-top: calc(var(--lh) * 4); }
  .box { padding: var(--lh) 2ch; }
  .experience__card-header { grid-template-columns: 1fr; }
  .experience__card-duration, .experience__card-duration--prev { grid-column: 1; grid-row: auto; text-align: left; white-space: normal; }
  .main-footer__upper { grid-template-columns: 1fr; }
}

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

/* logo-img-guard: the header photo is decoration, not something to open or drag */
.header__logo-img { pointer-events: none; -webkit-user-drag: none; user-select: none; }
