/* =========================================================================
   Yuri Bacciarini — CV site
   Tokens, layout, components, responsive, print. No frameworks, no webfonts.
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --bg-raised: #ffffff;
  --fg: #111827;
  --fg-muted: #4b5563;
  --fg-faint: #6b7280;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #e6f4f1;
  --border: #e2e5ea;
  --border-strong: #c9cfd8;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 8px 24px rgba(17, 24, 39, 0.05);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.75rem, 1.2rem + 1.6vw, 2.35rem);
  --step-4: clamp(2.25rem, 1.4rem + 3.4vw, 3.4rem);

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;

  --measure: 68ch;
  --wrap: 72rem;
  --radius: 10px;
  --radius-lg: 16px;
  --ring: 0 0 0 3px rgba(15, 118, 110, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0b1017;
    --bg-soft: #121a24;
    --bg-raised: #151e2a;
    --fg: #eef2f7;
    --fg-muted: #b3bdcb;
    --fg-faint: #93a0b1;
    --accent: #5eead4;
    --accent-strong: #99f6e4;
    --accent-soft: #10312e;
    --border: #22303f;
    --border-strong: #33475c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b1017;
  --bg-soft: #121a24;
  --bg-raised: #151e2a;
  --fg: #eef2f7;
  --fg-muted: #b3bdcb;
  --fg-faint: #93a0b1;
  --accent: #5eead4;
  --accent-strong: #99f6e4;
  --accent-soft: #10312e;
  --border: #22303f;
  --border-strong: #33475c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

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

h1,
h2,
h3 {
  margin: 0 0 var(--space-2);
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-4);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--step-3);
}

h3 {
  font-size: var(--step-1);
}

p {
  margin: 0 0 var(--space-3);
  max-width: var(--measure);
}

ul,
ol {
  margin: 0;
  padding: 0;
}

li {
  list-style: none;
}

a {
  color: var(--accent-strong);
  text-decoration-color: color-mix(in srgb, var(--accent-strong) 35%, transparent);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: currentColor;
}

strong {
  font-weight: 650;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -100px;
  z-index: 50;
  padding: var(--space-2) var(--space-3);
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius);
  font-weight: 650;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus-visible {
  top: var(--space-3);
}

/* ---------- Header ---------- */
.site-header {
  padding-block: var(--space-7) var(--space-6);
  background:
    radial-gradient(60rem 24rem at 85% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header--compact {
  padding-block: var(--space-6);
}

.header-grid {
  display: grid;
  gap: var(--space-5);
}

.eyebrow {
  margin: 0 0 var(--space-2);
  font-size: var(--step--1);
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.headline {
  margin: 0 0 var(--space-3);
  font-size: var(--step-1);
  font-weight: 550;
  color: var(--fg-muted);
  max-width: 46ch;
}

.lede {
  font-size: var(--step-0);
  color: var(--fg-muted);
  max-width: 58ch;
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: var(--step--1);
}

.link-strong {
  font-weight: 650;
  color: var(--accent-strong);
}

/* ---------- Metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--space-2);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-value {
  font-size: var(--step-2);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--fg-muted);
}

/* ---------- Section navigation ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 3.25rem;
}

.nav-list {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: var(--space-1);
  flex: 1;
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.nav-list a {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: var(--step--1);
  font-weight: 550;
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.theme-toggle {
  flex: none;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
}

.theme-toggle[hidden] {
  display: none;
}

/* ---------- Sections ---------- */
.section {
  padding-block: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: 0;
}

.section h2 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.section h2::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.section-intro {
  color: var(--fg-muted);
  margin-bottom: var(--space-4);
}

.section-note {
  margin-top: var(--space-3);
  font-size: var(--step--1);
  color: var(--fg-faint);
  font-style: italic;
}

/* ---------- Cards (AI skills) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-3);
}

.card {
  padding: var(--space-4);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: var(--step-0);
  margin-bottom: var(--space-2);
}

.card p {
  margin-bottom: var(--space-2);
  color: var(--fg-muted);
  font-size: var(--step--1);
}

.card p:last-child {
  margin-bottom: 0;
}

.evidence {
  font-size: 0.75rem !important;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg-faint) !important;
  text-transform: uppercase;
}

.subsection-title {
  margin: var(--space-5) 0 var(--space-2);
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.link-list {
  display: grid;
  gap: 0;
  max-width: var(--measure);
}

.link-list li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.link-list li:last-child {
  border-bottom: 0;
}

.link-list a {
  font-weight: 600;
}

.link-note {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--step--1);
  color: var(--fg-muted);
}

/* ---------- Skill groups ---------- */
.skill-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: var(--space-4);
}

.skill-group h3 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  margin-bottom: var(--space-2);
}

.skill-group--attention h3 {
  color: var(--accent-strong);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chips li {
  padding: 0.28rem 0.6rem;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--fg);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

.skill-group--attention .chips li {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-strong);
}

/* ---------- Timeline (experience, education, ventures) ---------- */
.timeline {
  position: relative;
  margin-top: var(--space-4);
}

.timeline-item {
  position: relative;
  padding-left: var(--space-5);
  padding-bottom: var(--space-5);
  break-inside: avoid;
  page-break-inside: avoid;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.55rem;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  z-index: 1;
}

.timeline-item::after {
  content: "";
  position: absolute;
  left: 0.65rem;
  top: 1.2rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item:last-child::after {
  display: none;
}

.timeline-item h3 {
  font-size: var(--step-0);
  margin-bottom: var(--space-1);
}

.role-note {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.75rem;
  font-weight: 550;
  letter-spacing: 0.03em;
  color: var(--fg-faint);
  text-transform: uppercase;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0 0 var(--space-2);
  font-size: var(--step--1);
}

.org {
  font-weight: 650;
  color: var(--fg);
}

.period,
.location {
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

.period::before {
  content: "· ";
}

.location::before {
  content: "· ";
}

.bullets {
  display: grid;
  gap: 0.4rem;
  max-width: var(--measure);
}

.bullets li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--fg-muted);
}

.bullets li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.68em;
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 50%;
  background: var(--border-strong);
}

.entry-result,
.entry-note {
  font-size: var(--step--1);
  color: var(--fg-muted);
}

.entry-note {
  max-width: var(--measure);
}

/* ---------- Lists (certifications, awards, speaking) ---------- */
.cert-list,
.award-list,
.plain-list {
  display: grid;
  gap: var(--space-3);
}

.cert-list li,
.award-list li {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  break-inside: avoid;
  page-break-inside: avoid;
}

.cert-list h3 {
  font-size: var(--step-0);
  margin-bottom: 0.2rem;
}

.cert-list .entry-meta,
.award-list .entry-meta {
  margin-bottom: var(--space-1);
}

.award-list p:last-child {
  margin-bottom: 0;
  color: var(--fg-muted);
}

.plain-list--spaced {
  gap: var(--space-3);
}

.plain-list--spaced li {
  padding-left: var(--space-4);
  border-left: 2px solid var(--border);
}

/* ---------- Contact ---------- */
.contact-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}

.contact-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.contact-label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.download-block {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: var(--step--1);
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: var(--space-5);
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  font-size: var(--step--1);
  color: var(--fg-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  justify-content: space-between;
}

.site-footer p {
  margin: 0;
  max-width: none;
}

.last-updated {
  font-variant-numeric: tabular-nums;
}

/* ---------- Responsive ---------- */
@media (min-width: 48rem) {
  .header-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: start;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics li:first-child {
    grid-column: span 2;
  }
}

@media (min-width: 64rem) {
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics li:first-child {
    grid-column: span 1;
  }

  .timeline-item {
    padding-left: var(--space-6);
  }
}

@media (max-width: 30rem) {
  .nav-inner {
    flex-wrap: wrap;
  }

  .nav-list {
    order: 2;
    width: 100%;
    padding-bottom: var(--space-2);
  }

  .metric {
    padding: var(--space-2);
  }

  .card {
    padding: var(--space-3);
  }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Print ---------- */
@media print {
  :root,
  :root[data-theme="dark"] {
    --bg: #ffffff;
    --bg-soft: #ffffff;
    --bg-raised: #ffffff;
    --fg: #000000;
    --fg-muted: #1f2937;
    --fg-faint: #374151;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --accent-soft: #ffffff;
    --border: #d1d5db;
    --border-strong: #9ca3af;
    --shadow: none;
    color-scheme: light;
  }

  body {
    font-size: 9.5pt;
    line-height: 1.4;
  }

  .site-nav,
  .theme-toggle,
  .skip-link,
  .header-links li:first-child {
    display: none !important;
  }

  .site-header {
    padding-block: 0 8pt;
    background: none;
  }

  h1 {
    font-size: 20pt;
  }

  h2 {
    font-size: 13pt;
    margin-top: 10pt;
  }

  h3 {
    font-size: 10.5pt;
  }

  .section {
    padding-block: 8pt;
    break-inside: auto;
  }

  .timeline-item,
  .cert-list li,
  .award-list li,
  .card {
    box-shadow: none;
    border: 0;
    border-left: 1.5pt solid #d1d5db;
    padding: 0 0 6pt 8pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .timeline-item::after {
    display: none;
  }

  .metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4pt;
  }

  .metric {
    border: 0.5pt solid #d1d5db;
    box-shadow: none;
    padding: 4pt;
  }

  .card-grid,
  .skill-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6pt;
  }

  .bullets li {
    color: #111827;
  }

  a {
    color: #115e59;
    text-decoration: none;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 7.5pt;
    color: #4b5563;
    word-break: break-all;
  }

  .site-footer {
    background: none;
    border-top: 0.5pt solid #d1d5db;
    padding-top: 6pt;
  }
}
