/* =========================================================
   martingolec.com — monochrome minimal
   ========================================================= */

/* ---------- Theme ---------- */
:root,
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-raised: #111111;
  --fg: #ededed;
  --muted: #8a8a8a;
  --faint: #5c5c5c;
  --line: #222222;
  --line-strong: #333333;
  --solid-bg: #ededed;
  --solid-fg: #0a0a0a;
  --grid: rgba(255, 255, 255, 0.06);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #fafafa;
  --bg-raised: #ffffff;
  --fg: #111111;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --line: #e6e6e6;
  --line-strong: #d4d4d4;
  --solid-bg: #111111;
  --solid-fg: #fafafa;
  --grid: rgba(0, 0, 0, 0.06);
  color-scheme: light;
}

:root {
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --nav-h: 64px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .4s ease;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 600; color: var(--fg); }
svg { display: block; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 40px; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: .03em; }
.dim { color: var(--muted); }

.skip { position: absolute; left: -999px; top: 8px; z-index: 300; background: var(--fg); color: var(--bg); padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* Scroll progress (1px line at the very top) */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200;
  background: var(--fg); transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: 11px 20px; border-radius: 8px;
  font: 500 14px/1 var(--sans);
  border: 1px solid transparent;
  transition: background-color .25s, color .25s, border-color .25s, transform .25s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-solid { background: var(--solid-bg); color: var(--solid-fg); }
.btn-solid:hover { opacity: .88; }
.btn-ghost { border-color: var(--line-strong); color: var(--fg); }
.btn-ghost:hover { border-color: var(--fg); }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: transparent; color: var(--fg); cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 8px;
  transition: border-color .25s, background-color .25s;
}
.icon-btn:hover { border-color: var(--fg); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .5s var(--ease), opacity .3s; }

/* Sun shows in dark mode (to switch to light), moon in light mode */
#theme-toggle { position: relative; }
#theme-toggle svg { position: absolute; }
:root[data-theme="dark"] .i-moon,
:root[data-theme="light"] .i-sun { opacity: 0; transform: rotate(-90deg) scale(.5); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100; height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: background-color .3s, border-color .3s;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom-color: var(--line);
}
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }

.links { display: flex; align-items: center; gap: 28px; font-size: 14px; }
.links a { color: var(--muted); transition: color .2s; position: relative; }
.links a:hover, .links a.active { color: var(--fg); }
.links a:not(.resume)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px; background: var(--fg);
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.links a.active::after { transform: scaleX(1); }
.links .resume { color: var(--fg); border-bottom: 1px solid var(--fg); padding-bottom: 1px; }

.nav-actions { display: flex; gap: 8px; }
.menu-btn { display: none; flex-direction: column; gap: 5px; }
.menu-btn span { width: 14px; height: 1.5px; background: currentColor; transition: transform .3s var(--ease); }
.menu-btn[aria-expanded="true"] span:first-child { transform: translateY(3.25px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-3.25px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--nav-h) + 60px) 0 80px;
}
.grid-bg {
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 40%, transparent 85%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 40%, transparent 85%);
  animation: grid-in 1.6s ease both;
}
@keyframes grid-in { from { opacity: 0; } to { opacity: 1; } }

.eyebrow { color: var(--muted); margin-bottom: 28px; text-transform: uppercase; }
.headline {
  font-size: clamp(3rem, 8.4vw, 7rem); font-weight: 600;
  line-height: .98; letter-spacing: -.05em; margin-bottom: 40px;
}
.headline span { display: block; }

.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; flex-wrap: wrap; }
.lead { color: var(--muted); font-size: 18px; max-width: 480px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

.hero-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; text-transform: uppercase;
}
.sep { color: var(--faint); }
.views { display: inline-flex; align-items: center; gap: 7px; }
.views svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.view-count { color: var(--fg); font-variant-numeric: tabular-nums; }

/* Load-in animation for hero pieces */
.load { opacity: 0; transform: translateY(18px); filter: blur(6px); animation: rise .9s var(--ease) forwards; animation-delay: calc(var(--d) * 110ms + 100ms); }
@keyframes rise { to { opacity: 1; transform: none; filter: blur(0); } }

/* ---------- Sections ---------- */
.section { padding: 120px 0; border-top: 1px solid var(--line); }
.label { color: var(--muted); margin-bottom: 20px; text-transform: uppercase; }
.title { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 600; line-height: 1.08; letter-spacing: -.035em; margin-bottom: 48px; max-width: 820px; }
.title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.text-link { color: var(--muted); border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; transition: color .2s, border-color .2s; margin-bottom: 48px; }
.text-link:hover { color: var(--fg); border-color: var(--fg); }

/* About */
.about { display: grid; grid-template-columns: 1.6fr 1fr; gap: 80px; align-items: start; }
.about .title { margin-bottom: 32px; }
.about-text p { color: var(--muted); font-size: 17px; margin-bottom: 18px; max-width: 620px; }

.about-text .cell-head { margin: 32px 0 14px; }
.coursework { display: flex; flex-wrap: wrap; gap: 8px; max-width: 620px; }
.coursework li {
  font-size: 14px; font-weight: 500; padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  transition: border-color .25s, background-color .25s;
}
.coursework li:hover { border-color: var(--fg); }
.facts { border-top: 1px solid var(--line); margin-top: 8px; }
.facts div { display: flex; justify-content: space-between; gap: 1rem; padding: 16px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); text-transform: uppercase; font-size: 12px; padding-top: 2px; }
.facts dd { font-weight: 500; text-align: right; }

/* Bordered cell grids (skills & projects) */
.cells { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cells-4 { grid-template-columns: repeat(4, 1fr); }
.cells-3 { grid-template-columns: repeat(3, 1fr); }
.cell {
  padding: 28px; position: relative;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--bg);
  transition: background-color .3s;
}
.cells-4 .cell:nth-child(4n), .cells-3 .cell:nth-child(3n) { border-right: 0; }
.cells-4 .cell:nth-last-child(-n+4), .cells-3 .cell:nth-last-child(-n+3) { border-bottom: 0; }

.cell-head { color: var(--muted); text-transform: uppercase; font-size: 12px; margin-bottom: 18px; }
.list li { padding: 6px 0; font-weight: 500; }

.project { display: flex; flex-direction: column; min-height: 280px; }
.project::before {
  /* thin line that sweeps across the top on hover */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--fg);
  transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease);
}
.project:hover { background: var(--bg-raised); }
.project:hover::before { transform: scaleX(1); }
.project-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.num { color: var(--faint); }
.arrow { color: var(--muted); font-size: 18px; transition: transform .35s var(--ease), color .2s; }
.project:hover .arrow { transform: translate(3px, -3px); color: var(--fg); }
.project h3 { font-size: 19px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 10px; }
.project p { color: var(--muted); font-size: 14.5px; flex: 1; margin-bottom: 20px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12px; }

/* Experience rows */
.rows { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 200px 1fr 1.3fr; gap: 32px; align-items: baseline;
  padding: 28px 0; border-bottom: 1px solid var(--line);
  transition: padding-left .4s var(--ease);
}
.row:hover { padding-left: 12px; }
.when { color: var(--muted); text-transform: uppercase; font-size: 12px; }
.row h3 { font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.org { color: var(--muted); font-size: 15px; }
.desc { color: var(--muted); font-size: 15px; }

/* Contact */
.contact { padding-bottom: 140px; }
.contact-title { font-size: clamp(2.6rem, 7vw, 5.5rem); font-weight: 600; line-height: 1; letter-spacing: -.05em; margin-bottom: 28px; }
.contact .lead { margin-bottom: 36px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: 12px; }

/* ---------- Scroll reveal ---------- */
.js .reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: var(--stagger, 0ms);
}
.js .reveal.in { opacity: 1; transform: none; }
/* Section borders draw in from the left */
.js .section { border-top-color: transparent; position: relative; }
.js .section::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 1px; background: var(--line);
  transform: scaleX(0); transform-origin: left; transition: transform 1.2s var(--ease);
}
.js .section.in::before { transform: scaleX(1); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .cells-4 { grid-template-columns: repeat(2, 1fr); }
  .cells-4 .cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .cells-4 .cell:nth-child(2n) { border-right: 0; }
  .cells-4 .cell:nth-last-child(-n+2) { border-bottom: 0; }
  .cells-3 { grid-template-columns: repeat(2, 1fr); }
  .cells-3 .cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .cells-3 .cell:nth-child(2n) { border-right: 0; }
  .cells-3 .cell:nth-last-child(-n+2) { border-bottom: 0; }
  .about { grid-template-columns: 1fr; gap: 40px; }
  .row { grid-template-columns: 160px 1fr; }
  .row .desc { grid-column: 2; }
}

@media (max-width: 820px) {
  .menu-btn { display: flex; align-items: center; justify-content: center; }
  .links {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    padding: 8px 24px 20px; background: var(--bg); border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: transform .35s var(--ease), opacity .25s, visibility .25s;
  }
  .links.open { transform: none; opacity: 1; visibility: visible; }
  .links a { padding: 12px 0; width: 100%; font-size: 16px; border-bottom: 1px solid var(--line); }
  .links a:not(.resume)::after { display: none; }
  .links .resume { border-bottom: 0; padding-bottom: 12px; }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .section { padding: 88px 0; }
  .cells-4, .cells-3 { grid-template-columns: 1fr; }
  .cells-4 .cell, .cells-3 .cell { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .cells-4 .cell:last-child, .cells-3 .cell:last-child { border-bottom: 0 !important; }
  .project { min-height: 0; }
  .project-top { margin-bottom: 24px; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .row .desc { grid-column: 1; margin-top: 6px; }
  .row:hover { padding-left: 0; }
  .hero-meta { margin-top: 48px; }
  .hero-meta .sep { display: none; }
  .facts dd { font-size: 15px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .load { opacity: 1; transform: none; filter: none; }
  .js .reveal { opacity: 1; transform: none; }
  .js .section::before { transform: scaleX(1); }
}

/* Job skills under the company name */
.job-skills { margin-top: 12px; }

/* Bulleted job descriptions */
.bullets li { position: relative; padding-left: 18px; margin-bottom: 8px; }
.bullets li:last-child { margin-bottom: 0; }
.bullets li::before {
  content: ""; position: absolute; left: 0; top: .8em;
  width: 8px; height: 1px; background: var(--muted);
}

/* Bulleted project descriptions */
.project .bullets {
  flex: 1; margin-bottom: 20px;
  color: var(--muted); font-size: 14.5px;
}
.project .bullets li { margin-bottom: 6px; }

