/* ---------- Design tokens ---------- */
/* Same slate + copper identity as the projects subdomain, so the two
   properties read as one person's work rather than two unrelated sites.
   Every text/background pair below meets WCAG AA (4.5:1) in both themes. */
:root {
  color-scheme: dark;
  --bg: #12161c;
  --surface: #1b232c;
  --surface-border: #2a3440;
  --ink: #e8ebee;
  --ink-muted: #9aa7b4;
  --primary: #24313f;
  --primary-light: #3a4d61;
  --accent: #c17817;
  --on-accent: #12161c;      /* text on copper buttons */
  --accent-2: #4fae7c;
  --now-bg: #231d17;         /* copper-tinted surface for the status row */

  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --wrap: 960px;
  --gutter: 1.5rem;
  --space-section: clamp(3.5rem, 7vw, 6rem);
  --header-h: 4rem;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-border: #dde1e5;
  --ink: #1b232c;
  --ink-muted: #55616c;
  --accent: #9c5b0e;         /* darker than dark-mode copper to keep 4.5:1 on #f5f6f7 */
  --on-accent: #ffffff;
  --accent-2: #2f7d55;
  --now-bg: #f6ede2;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; margin: 0 0 0.6em; }
h2 { font-size: 1.6rem; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
ul { margin: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Offset in-page anchors so the sticky header doesn't cover headings. */
[id] { scroll-margin-top: calc(var(--header-h) + 1rem); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.6em 1em;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--surface-border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--header-h);
}
.mark {
  font-family: var(--font-mono);
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}
.mark:hover { color: var(--accent); text-decoration: none; }
.site-nav {
  display: flex;
  gap: 1.25rem;
  margin-right: auto;
}
.site-nav a { color: var(--ink-muted); font-size: 0.95rem; white-space: nowrap; }
.site-nav a:hover { color: var(--ink); text-decoration: none; }

.header-tools { display: flex; gap: 0.5rem; }
.theme-toggle,
.lang-toggle,
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  color: var(--ink);
  height: 2.25rem;
  min-width: 2.25rem;
  cursor: pointer;
}
.lang-toggle { font-family: var(--font-mono); font-size: 0.8rem; padding: 0 0.6rem; }
.theme-toggle:hover,
.lang-toggle:hover,
.nav-toggle:hover { border-color: var(--accent); text-decoration: none; }
/* Icon shows the current theme; the button's aria-label says what a click does. */
.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ---------- Mobile menu ---------- */
/* Below 1024px the full nav doesn't fit on one line (Polish labels need
   ~970px, measured), so it collapses behind a "Menu" button into a panel.
   If nav labels get longer, re-check this breakpoint. */
.nav-toggle {
  display: none;
  gap: 0.45rem;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
}
.icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
.nav-toggle[aria-expanded="true"] { border-color: var(--accent); }

@media (max-width: 1023.98px) {
  .mark { margin-right: auto; }
  .js .nav-toggle { display: inline-flex; }

  .js .site-nav {
    display: none;
    position: absolute;          /* relative to the sticky .site-header */
    top: 100%;
    left: 0;
    right: 0;
    grid-template-columns: repeat(auto-fill, minmax(max(9rem, 23%), 1fr));   /* 2 cols on phones, max 4 */
    gap: 0 1.25rem;
    margin: 0;
    padding: 0.5rem max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter))) 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--surface-border);
    box-shadow: 0 12px 24px -12px rgb(0 0 0 / 0.35);
  }
  .js .site-nav.is-open { display: grid; }
  .js .site-nav a {
    display: block;
    padding: 0.7rem 0;           /* ≥44px tap target */
    font-size: 1rem;
    color: var(--ink);
    border-bottom: 1px solid var(--surface-border);
  }
  .js .site-nav a:hover { color: var(--accent); }

  /* Without JS the button can't work — show the links as a wrapped row. */
  html:not(.js) .header-row { flex-wrap: wrap; padding: 0.6rem 0; }
  html:not(.js) .site-nav { order: 3; width: 100%; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
}

/* ---------- Sections ---------- */
.section { padding-top: var(--space-section); }
.section > h2,
.section-head h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
/* Short copper rule before every section title — the site's one ornament. */
.section > h2::before,
.section-head h2::before {
  content: "";
  width: 1.5rem;
  height: 2px;
  background: var(--accent);
  flex-shrink: 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.section-head-link { font-weight: 500; font-size: 0.95rem; }
.section-intro { color: var(--ink-muted); margin-bottom: 2rem; }
.subhead { margin-top: 3rem; font-size: 1.2rem; }

/* ---------- Hero ---------- */
.hero { padding-top: var(--space-section); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 1rem;
}
.hero h1 { font-size: clamp(2.4rem, 6vw, 3.5rem); letter-spacing: -0.02em; margin-bottom: 0.4em; }
.hero-statement {
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  font-weight: 500;
  line-height: 1.4;
  max-width: 36ch;
}
.hero-body { color: var(--ink-muted); font-size: 1.05rem; }

.now {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 1.75rem 0;
  padding: 0.85rem 1.1rem;
  background: var(--now-bg);
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  max-width: none;
}
.now-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: var(--accent-2);
  vertical-align: 0.05em;
}
.now-label {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.now-text { flex: 1 1 20rem; }
@media (prefers-reduced-motion: no-preference) {
  .now-dot { animation: pulse 2.4s ease-in-out infinite; }
  @keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 55%, transparent); }
    50% { box-shadow: 0 0 0 0.35rem transparent; }
  }
}

.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.btn {
  display: inline-block;
  padding: 0.65em 1.35em;
  border-radius: 3px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--ink); color: var(--bg); }
.btn-ghost { border-color: var(--surface-border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); }

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
}
.social-row a { color: var(--ink-muted); overflow-wrap: anywhere; }
.social-row a:hover { color: var(--accent); }

/* ---------- Projects ---------- */
.cases { display: grid; gap: 1.5rem; }
.case,
.mini {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
}
.case { padding: clamp(1.25rem, 3vw, 2rem); }
.case-title { font-size: 1.3rem; margin-bottom: 1.25rem; }
.case-body {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 2rem;
}
.case-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0 0 0.35em;
}
.case-problem { font-weight: 500; }
.case-summary { color: var(--ink-muted); margin-bottom: 0; }
.case-aside {
  margin: 0;
  padding-left: 1.5rem;
  border-left: 1px solid var(--surface-border);
}
.case-aside dd { margin: 0 0 1.25rem; color: var(--ink-muted); font-size: 0.95rem; }
.case-aside dd:last-child { margin-bottom: 0; }

.card-link { display: inline-block; margin-top: 1.25rem; font-weight: 500; font-size: 0.95rem; }
/* Shown instead of a link that isn't live yet (demo, projects subdomain). */
.card-soon {
  display: inline-block;
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  border: 1px dashed var(--surface-border);
  border-radius: 999px;
  padding: 0.2em 0.8em;
}
.mini-meta .card-soon { margin-top: 0; }

.minis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.minis:empty { display: none; }
.mini {
  border-left-color: var(--accent-2);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem 2rem;
}
.mini-text { flex: 1 1 26rem; }
.mini-title { margin-bottom: 0.4em; }
.mini-lead { margin-bottom: 0.5em; font-weight: 500; font-size: 0.95rem; }
.mini-summary { color: var(--ink-muted); font-size: 0.95rem; margin: 0; }
.mini-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; }
.mini-meta .card-link { margin-top: 0; }

.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.tag-list li {
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  padding: 0.15em 0.5em;
  color: var(--ink);
}

/* ---------- About / How I work ---------- */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 0;
  border-top: 1px solid var(--surface-border);
  padding-top: 1.5rem;
}
.fact dt { color: var(--ink-muted); font-size: 0.85rem; margin-bottom: 0.25em; }
.fact dd { margin: 0; font-weight: 500; }

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.work-item {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 3px;
  padding: 1.25rem 1.5rem;
}
.work-item h4 { margin-bottom: 0.5em; }
.work-item p { color: var(--ink-muted); margin: 0; font-size: 0.95rem; }

/* ---------- Skills ---------- */
/* Grouped by how well I know them — deliberately no bars or percentages. */
.skill-groups { border-top: 1px solid var(--surface-border); }
.skill-group {
  display: grid;
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
  gap: 0.75rem 2rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--surface-border);
}
.skill-head { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }
.skill-head h3 { font-size: 1rem; margin: 0; }
.skill-level {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 0.05em 0.6em;
}
.chip-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em 1.1em;
  align-content: flex-start;
}
.chip-list li {
  padding-bottom: 0.15em;
  border-bottom: 2px solid var(--accent);
}

/* ---------- Education timeline (always expanded) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 0 2rem;
}
.timeline-dates {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0.2rem 0 0;
}
.timeline-content {
  position: relative;
  padding: 0 0 2rem 1.75rem;
  border-left: 1px solid var(--surface-border);
}
.timeline-item:last-child .timeline-content { padding-bottom: 0; }
.timeline-content::before {
  content: "";
  position: absolute;
  left: -0.35rem;
  top: 0.4rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline-title { margin-bottom: 0.25em; }
.timeline-meta { color: var(--ink-muted); font-size: 0.9rem; margin-bottom: 0.5em; }
.timeline-body { color: var(--ink-muted); margin: 0; }
.timeline-points {
  margin: 0.5em 0 0;
  padding-left: 1.1em;
  color: var(--ink-muted);
}
.timeline-points li { margin-bottom: 0.3em; }
.timeline-points li::marker { color: var(--accent); }

/* ---------- Interests ---------- */
.interest-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem 2.5rem;
}
.interest-grid h3 { font-size: 1rem; margin-bottom: 0.35em; }
.interest-grid p { color: var(--ink-muted); margin: 0; }

/* ---------- Contact ---------- */
.contact { padding-bottom: var(--space-section); }
.contact-heading { font-size: 1.2rem; font-weight: 500; margin-bottom: 0.4em; }
.contact-email {
  display: inline-block;
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
  font-weight: 500;
  margin-bottom: 1.25rem;
  overflow-wrap: anywhere;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--surface-border);
  padding: 2rem 0;
}
.footer-note { color: var(--ink-muted); font-size: 0.85rem; margin: 0; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  :root { --gutter: 1rem; }
  .header-row { gap: 1rem; }

  .case-body { grid-template-columns: 1fr; gap: 1.25rem; }
  .case-aside { padding-left: 0; border-left: 0; border-top: 1px solid var(--surface-border); padding-top: 1.25rem; }

  .work-grid,
  .interest-grid { grid-template-columns: 1fr; }
  .skill-group { grid-template-columns: 1fr; }

  .timeline-item { grid-template-columns: 1fr; }
  .timeline-dates { padding-left: 1.75rem; border-left: 1px solid var(--surface-border); margin: 0; padding-bottom: 0.3rem; }
  .timeline-content::before { top: -1.35rem; }
}
