/* fuadakpinar.com — the one stylesheet (docs/ARCHITECTURE.md §9–§12).
   Sections: 1 fonts · 2 tokens · 3 base · 4 layout · 5 nav · 6 components · 7 pages · 8 footer · 10 motion · 9 accessibility.
   Motion (reveal, card lift, hero drift) is always behind prefers-reduced-motion. */

/* 1. Fonts ------------------------------------------------------------------
   Self-hosted, static, subset (tools/fonts/subset.sh). A changed file gets a new
   version in its name, because /assets/fonts/* is cached as immutable (§15). */

@font-face {
  font-family: "Site Sans";
  src: url("/assets/fonts/body-400.v1.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Site Sans";
  src: url("/assets/fonts/body-600.v1.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Site Mono";
  src: url("/assets/fonts/mono-400.v1.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* Fallback faces: a local font resized to the web font's metrics, so text does not
   jump when the web font arrives (CLS). Values measured by tools/fonts/metrics.py. */
@font-face {
  font-family: "Site Sans Fallback";
  src: local("Arial"), local("ArialMT");
  font-weight: 400;
  size-adjust: 107.32%;
  ascent-override: 90.27%;
  descent-override: 22.48%;
  line-gap-override: 0.00%;
}
@font-face {
  font-family: "Site Sans Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT");
  font-weight: 600;
  size-adjust: 101.05%;
  ascent-override: 95.87%;
  descent-override: 23.87%;
  line-gap-override: 0.00%;
}
@font-face {
  font-family: "Site Mono Fallback";
  src: local("Courier New"), local("CourierNewPSMT");
  font-weight: 400;
  size-adjust: 99.98%;
  ascent-override: 102.02%;
  descent-override: 30.00%;
  line-gap-override: 0.00%;
}

/* 2. Tokens (§9.2, §10.2) ------------------------------------------------------ */

:root {
  /* 60 — ground */
  --bg-950: #0B0E13;   /* hero, deepest area */
  --bg-900: #101419;   /* main ground */
  --bg-800: #171C23;   /* card, panel */
  --bg-700: #1F262F;   /* hover ground */

  /* 30 — text and surface */
  --ink: #E8ECF1;      /* body text */
  --ink-dim: #8A94A3;  /* secondary text */
  --line: rgb(255 255 255 / 0.08);

  /* 10 — accent */
  --steel-500: #82A6CB;
  --steel-400: #9DBBD9;
  --steel-line: rgb(130 166 203 / 0.16);

  /* light section — steel is never used here (2.33:1) */
  --light-bg: #F3F5F8;
  --light-ink: #101419;
  --light-dim: #4D5661;
  --light-accent: #2F5E8E;

  --nav-bg: rgb(16 20 25 / 0.92);
  --nav-h: 80px;
  --nav-h-scrolled: 60px;

  --dur-fast: 160ms;
  --dur-base: 240ms;
  --dur-slow: 620ms;
  --ease: cubic-bezier(.16, .84, .34, 1);
  --ease-inout: cubic-bezier(.65, 0, .35, 1);

  --sans: "Site Sans", "Site Sans Fallback", system-ui, Arial, sans-serif;
  --mono: "Site Mono", "Site Mono Fallback", ui-monospace, "Courier New", monospace;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-pad: clamp(4rem, 9vw, 7.5rem);
}

/* 3. Base ------------------------------------------------------------------- */

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

html {
  font-family: var(--sans);
  font-synthesis: none;            /* never fake a bold or italic (§9.6) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg-900);
  color: var(--ink);
}

body {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.1;
  text-wrap: balance;
  overflow-wrap: break-word;   /* safety net: a long word never widens the page */
}
h1, h2 { letter-spacing: -0.02em; }

p, ul, ol { margin: 0; }

a {
  color: inherit;
  text-decoration-color: var(--steel-500);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}

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

code, kbd, .label, .mono { font-family: var(--mono); font-weight: 400; }

/* Species names: the one place a synthesised (slanted) style is allowed. There is no italic
   font file; synthesised bold stays forbidden everywhere (§9.6). */
i[lang="la"] { font-synthesis: style; }

/* Mono labels: lowercase voice, steel, never bold. "// 01  projects" keeps its two spaces;
   pre-wrap (not pre) so a long stack label can still wrap at 320 px. */
.label {
  font-size: .8125rem;
  letter-spacing: .04em;
  color: var(--steel-500);
  white-space: pre-wrap;
}

.muted { color: var(--ink-dim); }

/* 4. Layout ----------------------------------------------------------------- */

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-pad); }

.section--deep  { background: var(--bg-950);  color: var(--ink); }
.section--dark  { background: var(--bg-900);  color: var(--ink); }
.section--light { background: var(--light-bg); color: var(--light-ink); }

.section--light .label { color: var(--light-accent); }
.section--light .muted,
.section--light .access { color: var(--light-dim); }
.section--light a:not(.btn) {
  color: var(--light-ink);
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: .2em;
}

.section-head {
  display: grid;
  gap: .9rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section-head h2 { font-size: clamp(1.6rem, 1rem + 2vw, 2.6rem); }

/* 5. Nav (§10.8) -------------------------------------------------------------
   Fixed, outside the flow; .nav-spacer reserves its height. Solid by default.
   site.js adds .nav-live once it is wired; only then does the nav go transparent at
   the top and do the links collapse behind the menu button. No JS = solid nav, all links. */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav.is-scrolled { height: var(--nav-h-scrolled); }
.nav.nav-live:not(.is-scrolled) {
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
}
/* The spacer sits under the transparent nav, above the page head: same deep ground. */
.nav-spacer { height: var(--nav-h); background: var(--bg-950); }
.nav-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 16px;
  pointer-events: none;
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  min-height: 44px;
  font-weight: 600;
  text-decoration: none;
  margin-right: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
  padding: 0;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: .9375rem;
  color: var(--ink-dim);
  text-decoration: none;
}
.nav-links a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--steel-500);
}

/* Language switcher — nav and footer (§6). */
.lang ul {
  display: flex;
  gap: .25rem;
  list-style: none;
  padding: 0;
}
.lang a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: .4rem;
  font-family: var(--mono);
  font-size: .8125rem;
  letter-spacing: .04em;
  color: var(--ink-dim);
  text-decoration: none;
}
.lang a[aria-current="true"] { color: var(--steel-500); }

@media (hover: hover) and (pointer: fine) {
  .nav-links a:hover,
  .lang a:hover { color: var(--steel-400); }
}

/* Menu button: hidden unless site.js is live and the screen is narrow. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle[aria-expanded="true"] { border-color: var(--steel-500); }

@media (max-width: 640px) {
  /* Without site.js: tighten the row so everything still fits. */
  .nav-inner { gap: .75rem; }
  .nav-links { gap: .9rem; }
  .nav-links a { font-size: .875rem; }
  .nav-brand span { font-size: .9375rem; }

  /* With site.js: brand · language · button, the links in a panel under the bar. */
  .nav-live .nav-toggle { display: inline-flex; order: 3; }
  .nav-live .lang { order: 2; }
  .nav-live .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: .5rem var(--gutter) 1rem;
    background: var(--bg-900);
    border-bottom: 1px solid var(--line);
  }
  .nav-live .nav-menu.is-open { display: block; }
  .nav-live .nav-links { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-live .nav-links a {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
    border-bottom: 1px solid var(--line);
  }
  .nav-live .nav-links a[aria-current="page"] { box-shadow: none; color: var(--steel-500); }
}

/* 6. Components ------------------------------------------------------------- */

/* Outline button — steel outline, never a steel fill (§9.5). */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .7rem 1.25rem;
  border: 1px solid var(--steel-500);
  border-radius: 6px;
  font-weight: 600;
  font-size: .9375rem;
  color: var(--ink);
  text-decoration: none;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--steel-400); background: var(--steel-line); }
}

/* Text link with an icon (the CV download). */
.link-icon {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  font-size: .9375rem;
  color: var(--ink);
}
.link-icon svg { width: 1.1em; height: 1.1em; color: var(--steel-500); }

/* Project card (home page): the whole card is one <a>, nothing inside is a link (§13.2). */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18.5rem), 1fr));
  gap: 1.25rem;
  list-style: none;
  padding: 0;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  background: var(--bg-800);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2rem;
  color: var(--ink);
  text-decoration: none;
}
/* Number on its own line, tags on the next: every card has the same two-line head,
   so the titles line up whatever the tag list's length. */
.card-top {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  white-space: normal;   /* a long tag list may still wrap on a narrow card */
}
.card-tags { color: var(--ink-dim); }
.card h3 { font-size: 1.3125rem; line-height: 1.2; }
.card p { color: var(--ink-dim); font-size: 1rem; }
.card-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  font-size: .9375rem;
}
.card-go { color: var(--steel-500); }
.card-access { color: var(--ink-dim); }
@media (hover: hover) and (pointer: fine) {
  .card:hover { border-color: rgb(130 166 203 / 0.45); background: var(--bg-700); }
  .card:hover .card-go { color: var(--steel-400); }
}

.more { margin-top: 2rem; }

/* 7. Home ------------------------------------------------------------------- */

.hero { padding-block: clamp(4.5rem, 11vw, 9rem) clamp(4rem, 9vw, 7rem); }
.hero-aside { margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }
.hero h1 {
  max-width: 16ch;
  font-size: clamp(2.1rem, 1rem + 5vw, 5.5rem);   /* 2.1, not 2.4: "dönüştürüyorum." must fit at 320 px */
  line-height: 1.05;
}
.hero-lead {
  max-width: 44ch;
  margin-top: clamp(1.25rem, 2.5vw, 1.75rem);
  font-size: clamp(1.0625rem, 1rem + .4vw, 1.25rem);
  color: var(--ink-dim);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: clamp(2rem, 4vw, 2.75rem);
}

.now-list {
  list-style: none;
  padding: 0;
  max-width: 68ch;
  border-top: 1px solid rgb(16 20 25 / 0.12);
}
.now-list li {
  padding-block: 1rem;
  border-bottom: 1px solid rgb(16 20 25 / 0.12);
}

/* Inner pages: a shorter page head on the same deep ground as the hero. */
.page-head { padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(3rem, 6vw, 5rem); }
.page-head .label { display: block; margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem); }
.page-head h1 {
  max-width: 20ch;
  font-size: clamp(2.1rem, 1rem + 3.6vw, 4rem);
  line-height: 1.08;
}
.page-head .lead {
  max-width: 56ch;
  margin-top: clamp(1rem, 2vw, 1.5rem);
  font-size: clamp(1.0625rem, 1rem + .3vw, 1.1875rem);
  color: var(--ink-dim);
}

/* Projects page: one section per project, panels alternate in tone (§13.2). */
.section--panel { background: var(--bg-800); }
.project h2 { font-size: clamp(1.6rem, 1rem + 2vw, 2.6rem); }
.project .section-head { margin-bottom: clamp(1.75rem, 3.5vw, 2.5rem); }
.qa { display: grid; gap: 1.75rem; max-width: 60rem; }
.qa h3 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: .8125rem;
  letter-spacing: .04em;
  color: var(--ink-dim);
  margin-bottom: .4rem;
}
.qa p { max-width: 68ch; }
@media (min-width: 860px) {
  .qa > div { display: grid; grid-template-columns: 12rem 1fr; gap: 2rem; }
  .qa h3 { margin: .3rem 0 0; }
}
.access-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: clamp(2rem, 4vw, 2.75rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.access { color: var(--ink-dim); }
.btn svg { width: 1em; height: 1em; color: var(--steel-500); }

/* About (§13.5): label/value rows, kept in one place so the status line is easy to update. */
.facts {
  display: grid;
  margin: 0;
  max-width: 60rem;
  border-top: 1px solid var(--line);
}
.facts > div { padding-block: 1.1rem; border-bottom: 1px solid var(--line); }
.facts dt {
  font-family: var(--mono);
  font-size: .8125rem;
  letter-spacing: .04em;
  color: var(--ink-dim);
  margin-bottom: .3rem;
}
.facts dd { margin: 0; max-width: 68ch; }
@media (min-width: 860px) {
  .facts > div { display: grid; grid-template-columns: 12rem 1fr; gap: 2rem; }
  .facts dt { margin: .25rem 0 0; }
}
.page-head .bio { display: grid; gap: 1rem; max-width: 62ch; margin-top: clamp(1.25rem, 2.5vw, 1.75rem); color: var(--ink-dim); font-size: clamp(1.0625rem, 1rem + .3vw, 1.1875rem); }

/* Case study (§13.4). */
.page-head .tags { display: block; margin-top: 1.25rem; color: var(--ink-dim); }
.prose { max-width: 68ch; display: grid; gap: 1rem; }
.prose ul { padding-left: 1.2rem; display: grid; gap: .6rem; }
.prose li::marker { color: var(--steel-500); }

.decisions {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0;
  max-width: 60rem;
  counter-reset: decision;
  border-top: 1px solid var(--line);
}
.decisions li {
  counter-increment: decision;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.decisions h3 { font-size: 1.1875rem; line-height: 1.25; }
.decisions h3::before {
  content: counter(decision, decimal-leading-zero) "  ";
  white-space: pre;
  font-family: var(--mono);
  font-weight: 400;
  font-size: .8125rem;
  letter-spacing: .04em;
  color: var(--steel-500);
}
.decisions p { margin-top: .5rem; max-width: 68ch; color: var(--ink-dim); }
@media (min-width: 860px) {
  .decisions li { display: grid; grid-template-columns: 22rem 1fr; gap: 2rem; }
  .decisions p { margin-top: 0; }
}

.figure {
  margin: 0;
  padding: clamp(1rem, 3vw, 2rem);
  background: var(--bg-950);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}
.figure img { width: 100%; min-width: 40rem; height: auto; }
.figure figcaption, .term-caption { margin-top: 1rem; font-size: .9375rem; color: var(--ink-dim); }

/* Terminal output as text, not an image (§9.9): searchable, scalable, scanned by check 13. */
.term {
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: var(--bg-950);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .8125rem;
  line-height: 1.7;
  color: var(--ink);
}
.term .dim { color: var(--ink-dim); }
.term .ok  { color: var(--steel-500); }

/* 8. Footer (§13.8) ----------------------------------------------------------- */

.footer {
  background: var(--bg-900);
  border-top: 1px solid var(--line);
  padding-block: 3rem;
  font-size: .9375rem;
}
.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}
.footer-brand { font-weight: 600; }
.footer-col { display: grid; gap: .5rem; align-content: start; }
.footer-col p { color: var(--ink-dim); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  list-style: none;
  padding: 0;
}
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-dim); text-decoration: none; }
.footer .lang a { padding-inline: 0 .9rem; }
@media (min-width: 720px) {
  .footer-col--right { justify-items: end; }
}
@media (hover: hover) and (pointer: fine) {
  .footer-links a:hover { color: var(--steel-400); }
}

/* 10. Motion (§10) -----------------------------------------------------------
   Every transition, animation and transform lives behind no-preference: with reduced
   motion (or no support for the query) the page renders in its finished state. */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Layer 0 — hover and state changes */
  .nav {
    transition: height var(--dur-base) var(--ease),
                background-color var(--dur-base) var(--ease),
                border-color var(--dur-base) var(--ease);
  }
  .nav-links a, .lang a, .footer-links a, .btn, .card-go, .nav-toggle {
    transition: color var(--dur-fast) var(--ease),
                background-color var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease);
  }
  .card {
    transition: transform var(--dur-base) var(--ease),
                box-shadow var(--dur-base) var(--ease),
                border-color var(--dur-base) var(--ease),
                background-color var(--dur-base) var(--ease);
  }
  @media (hover: hover) and (pointer: fine) {
    .card:hover {
      transform: translateY(-6px);
      box-shadow: 0 18px 40px -12px rgb(0 0 0 / 0.55);
    }
  }

  /* Layer 1 — reveal (reveal.js). Hidden from first paint, with a 3 s failsafe. */
  .js [data-reveal]:not(.is-visible) {
    opacity: 0;
    transform: translateY(18px);
    animation: reveal-failsafe 0s 3s forwards;
  }
  .reveal-ready [data-reveal]:not(.is-visible) { animation: none; }

  .js [data-reveal] {
    transition: opacity var(--dur-slow) var(--ease),
                transform var(--dur-slow) var(--ease);
  }
  [data-reveal][data-delay="1"] { transition-delay: 80ms; }
  [data-reveal][data-delay="2"] { transition-delay: 160ms; }
  [data-reveal][data-delay="3"] { transition-delay: 240ms; }

  /* word by word: the heading stays put, its words move */
  .js [data-reveal].is-split { opacity: 1; transform: none; animation: none; transition: none; }
  .is-split .w {
    display: inline-block;
    opacity: 0;
    transform: translateY(.45em);
    transition: opacity var(--dur-slow) var(--ease),
                transform var(--dur-slow) var(--ease);
  }
  .is-split.is-visible .w { opacity: 1; transform: none; }

  /* Layer 2 — scroll-driven hero drift; progressive enhancement (§10.6).
     animation-timeline must come after the animation shorthand, which resets it. */
  @supports (animation-timeline: scroll()) {
    .hero-aside {
      animation: drift linear both;
      animation-timeline: scroll(root);
      animation-range: 0 60vh;
    }
    @keyframes drift {
      from { transform: none;                          opacity: 1;  }
      to   { transform: translateY(-40px) scale(1.04); opacity: .4; }
    }
  }
}

@keyframes reveal-failsafe { to { opacity: 1; transform: none; } }

/* 9. Accessibility (§12) ----------------------------------------------------- */

:focus-visible { outline: 2px solid var(--steel-400); outline-offset: 3px; }
.section--light :focus-visible { outline-color: var(--light-ink); }

[id] { scroll-margin-top: calc(var(--nav-h-scrolled) + 1rem); }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: .75rem 1rem;
  background: var(--bg-800);
  color: var(--ink);
  border: 1px solid var(--steel-500);
  border-radius: 6px;
}
.skip-link:focus { top: 1rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
