/* ------------------------------------------------------------------
   marz1307.github.io design system
   Engineered document. Fraunces / IBM Plex Sans / JetBrains Mono.
------------------------------------------------------------------ */

:root {
  --surface:          #F5F1EA;
  --surface-elevated: #FFFFFF;
  --ink:              #1A1915;
  --ink-muted:        #5A564E;
  --ink-subtle:       #6F6A5E;  /* WCAG AA: 5.3:1 on --surface */
  --accent:           #B8401C;  /* WCAG AA: 4.71:1 on --surface, 5.36:1 with white */
  --accent-ink:       #FFFFFF;
  --divider:          #E8E2D6;
  --code-bg:          #EFE9DC;

  --font-display: "Fraunces", "Times New Roman", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "Courier New", monospace;

  --container: 1120px;
  --pad-x: 24px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-quint: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --surface:          #14130F;
  --surface-elevated: #1E1C17;
  --ink:              #F1ECE0;
  --ink-muted:        #A39E91;
  --ink-subtle:       #8E8978;  /* WCAG AA: 5.06:1 on --surface */
  --accent:           #E76A3F;
  --accent-ink:       #14130F;
  --divider:          #2B2822;
  --code-bg:          #201E18;
}

@media (min-width: 768px) { :root { --pad-x: 48px; } }
@media (min-width: 1100px) { :root { --pad-x: 64px; } }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}

@media (min-width: 768px) { body { font-size: 17px; } }

img, svg { max-width: 100%; height: auto; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 200ms var(--ease-out);
}
a:hover { color: var(--accent); }

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

/* skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-ink);
  padding: 12px 16px; z-index: 100; font-weight: 500;
}
.skip-link:focus { left: 16px; top: 16px; outline: none; }

/* container */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

/* typography */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.2; }
h1 { font-size: 44px; font-weight: 900; line-height: 1.1; letter-spacing: -0.01em; }
h2 { font-size: 32px; }
h3 { font-size: 22px; line-height: 1.3; }

@media (max-width: 640px) {
  h1 { font-size: 36px; }
  h2 { font-size: 26px; }
}

p { margin: 0 0 16px 0; }

.body-large { font-size: 19px; line-height: 1.5; }
.caption {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-muted); }

/* section indicator */
.section-indicator {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-subtle);
  margin-bottom: 24px;
  display: block;
}

/* sections */
section { padding: 64px 0; }
@media (min-width: 768px) { section { padding: 96px 0; } }
@media (min-width: 1100px) { section { padding: 128px 0; } }

.divider-top { border-top: 1px solid var(--divider); }

/* header / nav */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--divider);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; padding-bottom: 16px;
  gap: 16px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); }
.nav { display: flex; gap: 24px; align-items: center; }
.nav a {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  color: var(--ink);
}
.nav a.active {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.nav-toggle { display: none; }
@media (max-width: 640px) {
  /* hide text nav links on mobile, keep utility toggles visible */
  .nav a:not(.lang-toggle):not(.cta-mini) { display: none; }
  .nav { gap: 12px; }
}

/* lang toggle (same look as theme toggle) */
.lang-toggle {
  background: transparent;
  border: 1px solid var(--divider);
  color: var(--ink);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  border-radius: 2px;
  text-decoration: none;
  transition: border-color 200ms var(--ease-out), color 200ms var(--ease-out);
  display: inline-block;
}
.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* theme toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--divider);
  color: var(--ink);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 2px;
  transition: border-color 200ms var(--ease-out), color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 1px 0 var(--divider);
}

/* buttons */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 200ms var(--ease-out), background-color 200ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out);
  border: 1px solid transparent;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-2px); color: var(--accent-ink); }
.btn-secondary {
  background: transparent; color: var(--ink); border-color: var(--ink);
}
.btn-secondary:hover {
  border-color: var(--accent); color: var(--accent); transform: translateY(-2px);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* chip / stack tag */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  background: var(--code-bg);
  color: var(--ink-muted);
  border-radius: 2px;
  line-height: 1.4;
}
.chip img.chip-icon,
.chip svg.chip-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  flex-shrink: 0;
}
.chip svg.chip-icon { fill: currentColor; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* a11y: visible focus rings on every interactive surface */
:where(a, button, .card, .arrow-link, .lang-toggle, .theme-toggle):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* touch targets: WCAG 2.5.5 >= 40px on nav and toggles */
.nav a,
.lang-toggle,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
}

/* hero */
.hero { padding-top: 64px; padding-bottom: 64px; position: relative; overflow: hidden; }
.topo {
  position: absolute;
  pointer-events: none;
  color: var(--ink-muted);
  opacity: 0.32;
  z-index: 0;
}
[data-theme="dark"] .topo { opacity: 0.24; }

/* corner motif on page headers + case study heads */
.topo-corner {
  right: -160px; top: -120px;
  width: 480px; height: 480px;
}
@media (max-width: 700px) {
  .topo-corner { right: -260px; top: -180px; width: 360px; height: 360px; opacity: 0.18; }
}

.page-head, .case-header { position: relative; overflow: hidden; }
.page-head > *:not(.topo), .case-header > *:not(.topo) { position: relative; z-index: 1; }
@media (min-width: 1024px) { .hero { padding-top: 96px; padding-bottom: 96px; } }
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: center;
}
@media (min-width: 1024px) {
  .hero-grid { grid-template-columns: 1.1fr 1fr; gap: 64px; }
}
.hero-headline {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 24px 0;
}
@media (min-width: 768px) { .hero-headline { font-size: 56px; } }
@media (min-width: 1280px) { .hero-headline { font-size: 68px; } }

.hero-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.3;
  color: var(--accent);
  margin: -8px 0 24px 0;
  letter-spacing: -0.005em;
}
@media (max-width: 768px) { .hero-tagline { font-size: 18px; } }

.hero-sub {
  font-size: 19px; line-height: 1.5; color: var(--ink-muted);
  max-width: 560px; margin-bottom: 32px;
}
.hero-stack {
  margin-top: 24px;
}
.hero-diagram-caption {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-subtle);
  margin-top: 16px;
}

/* pipeline diagram */
.pipeline-svg { width: 100%; height: auto; display: block; }
.pipeline-node-bg {
  fill: var(--surface-elevated);
  stroke: var(--ink-muted);
  stroke-width: 1.5;
  transition: fill 200ms var(--ease-out), stroke 200ms var(--ease-out);
}
.pipeline-node-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  fill: var(--ink);
  text-transform: uppercase;
}
.pipeline-line {
  stroke: var(--ink-muted);
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: flow 800ms var(--ease-quint) forwards;
}
.pipeline-line.l2 { animation-delay: 120ms; }
.pipeline-line.l3 { animation-delay: 240ms; }
.pipeline-line.l4 { animation-delay: 360ms; }
.pipeline-node:hover .pipeline-node-bg,
.pipeline-node:focus .pipeline-node-bg {
  fill: var(--accent);
  stroke: var(--accent);
}
.pipeline-node:hover .pipeline-node-label,
.pipeline-node:focus .pipeline-node-label {
  fill: var(--accent-ink);
}
.pipeline-node { cursor: default; }
.pipeline-tooltip-text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--ink-muted);
}

@keyframes flow { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .pipeline-line { animation: none; stroke-dashoffset: 0; }
  * { transition: none !important; }
}

/* what-i-do blocks */
.three-col {
  display: grid; gap: 32px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) { .three-col { grid-template-columns: repeat(3, 1fr); gap: 48px; } }
.disc h3 { margin-bottom: 12px; }
.disc .chip-row { margin-top: 16px; }

/* project cards */
.cards {
  display: grid; gap: 32px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex; flex-direction: column;
  background: var(--surface-elevated);
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 32px;
  text-decoration: none;
  color: inherit;
  transition: transform 200ms var(--ease-out), border-color 200ms var(--ease-out);
  height: 100%;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); color: inherit; }
.card .meta {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink-subtle); margin-bottom: 12px; text-transform: uppercase;
}
.card h3 { margin-bottom: 12px; }
.card p { color: var(--ink-muted); margin-bottom: 16px; flex-grow: 1; }

/* projects index list */
.project-list { display: flex; flex-direction: column; gap: 64px; }
.project-row {
  display: grid; grid-template-columns: 1fr; gap: 16px;
  padding-bottom: 64px; border-bottom: 1px solid var(--divider);
}
.project-row:last-child { border-bottom: none; padding-bottom: 0; }
@media (min-width: 768px) {
  .project-row { grid-template-columns: 120px 1fr; gap: 48px; }
}
.project-row .stamp {
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-subtle);
  letter-spacing: 0.04em;
}
.project-row .body h2 a { text-decoration: none; }
.project-row .body h2 a:hover { color: var(--accent); }
.project-row .role {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink-muted); margin: 8px 0 16px 0; text-transform: uppercase;
}

/* about-page narrative */
.prose { max-width: 680px; margin: 0 auto; }
.prose p { font-size: 17px; line-height: 1.7; }
.prose .body-large { font-size: 21px; line-height: 1.5; }
.prose h2 { margin-top: 16px; margin-bottom: 16px; }
.prose .chapter { margin-bottom: 64px; }
.prose .chapter-stamp {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em;
  color: var(--ink-subtle); margin-bottom: 12px; text-transform: uppercase;
}

.cert-table {
  width: 100%; border-collapse: collapse; margin-top: 16px;
  font-size: 15px;
}
.cert-table td {
  padding: 12px 0; border-bottom: 1px solid var(--divider);
  vertical-align: top;
}
.cert-table td.issuer {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink-muted); text-align: right; white-space: nowrap; padding-left: 16px;
  text-transform: uppercase;
}

.education-list { list-style: none; padding: 0; margin: 0; }
.education-list li {
  padding: 12px 0; border-bottom: 1px solid var(--divider);
}
.education-list li:last-child { border-bottom: none; }
.education-list strong { font-weight: 600; }

.currently { background: var(--surface-elevated); border: 1px solid var(--divider); padding: 32px; border-radius: 4px; }
.currently ul { list-style: none; padding: 0; margin: 16px 0 0 0; }
.currently li { padding: 8px 0; }
.currently li strong { font-weight: 600; }

/* case study */
.case-header { padding: 48px 0 32px 0; }
.breadcrumb {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink-subtle); text-transform: uppercase; margin-bottom: 24px;
}
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.case-title { font-size: 44px; margin-bottom: 16px; }
.case-sub { font-size: 19px; color: var(--ink-muted); max-width: 720px; margin-bottom: 24px; line-height: 1.5; }

.metadata-strip {
  display: grid; gap: 12px; grid-template-columns: 1fr;
  padding: 24px 0; border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider);
  margin: 32px 0;
}
@media (min-width: 768px) { .metadata-strip { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .metadata-strip { grid-template-columns: repeat(4, 1fr); } }
.metadata-strip .label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--ink-subtle); text-transform: uppercase; display: block; margin-bottom: 4px;
}
.metadata-strip .value { font-size: 14px; }

.confidentiality {
  font-family: var(--font-mono); font-style: italic; font-size: 13px;
  color: var(--ink-muted); padding: 16px; border-left: 2px solid var(--accent);
  background: var(--code-bg); margin: 32px 0;
}

/* Prominent repo CTA at the top of each case study */
.repo-cta { margin: 24px 0 8px 0; }
.repo-cta .btn { font-size: 14px; padding: 10px 18px; }
.repo-cta .btn::before { content: ""; }

/* Project card thumbnail (home + projects index) */
.project-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  margin-bottom: 16px;
  background: #14130F;
  border: 1px solid var(--divider);
}
.project-thumb picture, .project-thumb img {
  width: 100%; height: 100%; display: block;
}
.project-thumb img {
  object-fit: cover; object-position: center;
  transition: opacity 200ms var(--ease-out);
}
.card:hover .project-thumb img,
.project-row:hover .project-thumb img { opacity: 0.92; }

/* Case study hero thumbnail (top of detail page) */
.case-hero-thumb {
  width: 100%;
  max-width: 880px;
  margin: 0 auto 32px auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  background: #14130F;
  border: 1px solid var(--divider);
}
.case-hero-thumb picture, .case-hero-thumb img {
  width: 100%; height: 100%; display: block;
  object-fit: cover; object-position: center;
}

/* projects index row layout adjustment to accommodate thumb */
.project-row .body .project-thumb { max-width: 480px; }

.case-section { max-width: 720px; margin: 0 auto 48px auto; }
.case-section h2 { margin-bottom: 16px; font-size: 28px; }
.case-section p { font-size: 17px; line-height: 1.7; }

.metrics-block {
  display: grid; gap: 24px; grid-template-columns: 1fr;
  margin: 32px 0;
}
@media (min-width: 640px) { .metrics-block { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .metrics-block { grid-template-columns: repeat(4, 1fr); } }
.metric {
  background: var(--surface-elevated);
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 24px;
}
.metric .num {
  font-family: var(--font-display); font-weight: 900;
  font-size: 36px; line-height: 1; color: var(--accent);
  margin-bottom: 8px; letter-spacing: -0.01em;
}
.metric .cap {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--ink-muted); text-transform: uppercase; line-height: 1.4;
}

/* architecture diagram (case study) */
.arch-diagram {
  background: var(--surface-elevated);
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 24px;
  margin: 32px 0;
  overflow-x: auto;
}

.case-nav {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between;
  margin: 64px auto 0 auto;
  max-width: 720px;
  padding-top: 32px;
  border-top: 1px solid var(--divider);
}
.case-nav a { text-decoration: none; }
.case-nav a:hover { color: var(--accent); }

/* footer */
.site-footer {
  border-top: 1px solid var(--divider);
  padding: 48px 0;
  margin-top: 64px;
  font-size: 14px;
  color: var(--ink-muted);
}
.site-footer .container {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .site-footer .container { grid-template-columns: 1.5fr 1fr; align-items: end; }
  .site-footer .right { text-align: right; }
}
.site-footer a { color: var(--ink-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .meta-line {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink-subtle); text-transform: uppercase;
}

/* 404 */
.error-page {
  text-align: center; padding: 96px 0;
}
.error-page h1 { margin: 16px 0 24px 0; }
.error-page .links {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
  margin-top: 32px;
}
.error-page .links a {
  font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.04em;
  text-transform: uppercase; text-decoration: none; color: var(--ink);
}
.error-page .links a:hover { color: var(--accent); }

/* contact */
.contact-grid {
  display: grid; gap: 24px; grid-template-columns: 1fr;
  margin-top: 32px;
}
@media (min-width: 768px) { .contact-grid { grid-template-columns: repeat(3, 1fr); } }
.contact-grid a {
  font-family: var(--font-body); font-weight: 500; font-size: 18px;
  color: var(--ink); text-decoration: none;
  padding: 24px 28px; border: 1px solid var(--divider);
  border-radius: 4px; background: var(--surface-elevated);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  transition: border-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.contact-grid a:hover {
  border-color: var(--accent); color: var(--accent); transform: translateY(-2px);
}
.contact-grid .arrow {
  font-family: var(--font-mono); color: var(--ink-subtle); font-size: 16px;
  transition: color 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.contact-grid a:hover .arrow { color: var(--accent); transform: translateX(2px); }

/* page header for sub pages */
.page-head { padding: 64px 0 32px 0; }
.page-head h1 { margin-bottom: 16px; }
.page-head .sub { color: var(--ink-muted); font-size: 19px; max-width: 680px; }

/* about page header (two-column with portrait) */
.about-head {
  display: grid; gap: 48px; align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .about-head {
    grid-template-columns: 1.4fr 1fr; gap: 64px;
  }
}
.portrait {
  margin: 0;
  aspect-ratio: 4 / 5;
  max-width: 360px;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--divider);
  background: var(--surface-elevated);
  justify-self: end;
}
@media (max-width: 899px) {
  .portrait { justify-self: start; max-width: 280px; }
}
.portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  /* crop to keep face/upper body, photo is portrait orientation */
  object-position: 50% 28%;
  display: block;
}

/* link-with-arrow */
.arrow-link {
  font-family: var(--font-body); font-weight: 500;
  text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--accent); padding-bottom: 2px;
  display: inline-block;
}
.arrow-link:hover { color: var(--accent); }

/* scroll reveal */
.reveal {
  opacity: 0; transform: translateY(12px);
  transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out);
}
.reveal.in { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
