/* simonemachetti.com — static site styles.
   Design tokens are defined on :root. Dark is the default theme; light overrides below. */

:root {
  color-scheme: dark;
  --color-bg: #1c1a18;
  --color-surface: #2d2b2b;
  --color-text: #f3f2f2;
  --color-text-secondary: #eae7e7;
  --color-text-muted: #d7d3d3;
  --color-text-faint: #bab6b6;
  --color-divider: rgba(243, 242, 242, 0.16);
  --color-accent: #e1ad66;
  --color-accent-text: #e1ad66;
  --color-accent-hover: #facb8d;

  --accent-tint-10: rgba(225, 173, 102, 0.10);
  --accent-tint-12: rgba(225, 173, 102, 0.12);
  --accent-tint-18: rgba(225, 173, 102, 0.18);
  --accent-tint-22: rgba(225, 173, 102, 0.22);
  --accent-tint-30: rgba(225, 173, 102, 0.30);
  --accent-tint-40: rgba(225, 173, 102, 0.40);

  --font-heading: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Lora", Georgia, "Times New Roman", serif;

  --radius-md: 4px;

  --nav-height: 72px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201f1d;
  --color-text-secondary: #444141;
  --color-text-muted: #605d5d;
  --color-text-faint: #7d7979;
  --color-divider: rgba(32, 31, 29, 0.16);
  --color-accent: #b68235;
  --color-accent-text: #7d5411;
  --color-accent-hover: #a06f24;

  --accent-tint-10: rgba(182, 130, 53, 0.10);
  --accent-tint-12: rgba(182, 130, 53, 0.12);
  --accent-tint-18: rgba(182, 130, 53, 0.18);
  --accent-tint-22: rgba(182, 130, 53, 0.22);
  --accent-tint-30: rgba(182, 130, 53, 0.30);
  --accent-tint-40: rgba(182, 130, 53, 0.40);
}

/* ---------- base ---------- */

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
}

body, .site-header, .btn, .card, .tag, .tl-dot, .tl-line, .edu-row, .pub-row, .site-footer, .section {
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

h1, h2, h3 {
  font-family: var(--font-heading);
  margin: 0;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }

a {
  color: var(--color-accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
a:hover { color: var(--color-accent-hover); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: var(--accent-tint-30); }

.tnum { font-feature-settings: "tnum" 1; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

section[id] { scroll-margin-top: var(--nav-height); }

/* ---------- labels & headings ---------- */

.kicker {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-text);
  margin: 0 0 28px;
}
.kicker-tight { margin-bottom: 16px; }
.kicker-heading { margin-bottom: 8px; }

.section-title {
  font-weight: 400;
  font-size: 40px;
  line-height: 1.1;
  margin: 0 0 36px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  color: var(--color-text);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  cursor: pointer;
}
.btn svg { display: block; flex: none; }
.btn:hover { color: inherit; }

.btn-primary { color: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover { color: var(--color-accent); background: var(--accent-tint-12); }
.btn-primary:active { background: var(--accent-tint-22); }

.btn-ghost { color: var(--color-accent-text); }
.btn-ghost:hover { color: var(--color-accent-text); background: var(--accent-tint-10); }
.btn-ghost:active { background: var(--accent-tint-18); }

.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ---------- header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-divider);
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 20px;
}

.nav-brand {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.2;
  color: inherit;
  text-decoration: none;
  margin-right: auto;
}
.nav-brand:hover { color: inherit; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links a {
  font-size: 14px;
  color: inherit;
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a[aria-current="location"] { color: var(--color-accent-text); }

.theme-toggle { margin-left: 4px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }

.menu-toggle { display: none; color: var(--color-text); }
.menu-toggle .icon-x { display: none; }
.menu-open .menu-toggle .icon-menu { display: none; }
.menu-open .menu-toggle .icon-x { display: block; }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1fr 205px;
  gap: 72px;
  align-items: center;
  padding: 88px 0 80px;
}

.hero-text { min-width: 0; }
.hero-kicker { margin-bottom: 22px; }

.hero-name {
  font-weight: 400;
  font-size: clamp(36px, 6vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0 0 22px -0.04em;
  white-space: nowrap;
}

.hero-headline {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.3;
  margin: 0 0 14px;
}

.hero-tagline {
  font-size: 17px;
  line-height: 1.65;
  color: var(--color-text-muted);
  max-width: 52ch;
  margin: 0 0 30px;
}

.actions,
.actions-primary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.plate {
  border-radius: 50%;
  overflow: hidden;
  filter: sepia(0.22) saturate(0.82) contrast(1.05);
}
.hero-photo {
  width: 205px;
  aspect-ratio: 1 / 1;
  justify-self: end;
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- sections ---------- */

.section {
  padding: 64px 0;
  border-top: 1px solid var(--color-divider);
}

/* Justified body text, with hyphenation to keep word spacing even.
   Lists of titles and headlines stay left-aligned. */
.about-text,
.tl-text,
.tl-bullets li,
.edu-note,
.card-body,
.highlight p {
  text-align: justify;
  hyphens: auto;
}

/* About */
.about-text {
  font-size: 17px;
  line-height: 1.7;
  max-width: 72ch;
  margin: 0 0 28px;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--color-accent);
  border-radius: 3px;
  color: var(--color-accent-text);
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.skills {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 28px 0 0;
  max-width: 72ch;
}
.skills dt {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding-top: 2px;
}
.skills dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

/* Experience */
.timeline {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--color-divider);
  padding-top: 28px;
}

.tl-item {
  display: grid;
  grid-template-columns: 200px 24px 1fr;
  column-gap: 20px;
  padding-bottom: 40px;
}
.tl-item:last-child { padding-bottom: 0; }

.tl-meta {
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-feature-settings: "tnum" 1;
  padding-top: 5px;
}
.tl-place {
  display: block;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-text-faint);
}

.tl-marker {
  position: relative;
  display: flex;
  justify-content: center;
}
.tl-dot {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--color-accent);
  background: var(--color-bg);
  margin-top: 9px;
}
.tl-line {
  position: absolute;
  top: 20px;
  bottom: -40px;
  width: 1px;
  background: var(--color-divider);
}

.tl-body h3 {
  font-weight: 600;
  font-size: 23px;
  line-height: 1.2;
  margin: 0 0 4px;
}
.tl-org {
  font-size: 15px;
  color: var(--color-accent-text);
  margin: 0 0 8px;
}
.tl-text {
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text-secondary);
  max-width: 64ch;
}
.tl-bullets {
  margin: 10px 0 0;
  padding-left: 18px;
  list-style: disc;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 64ch;
}
.tl-subhead {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-text);
  margin: 18px 0 0;
}
.tl-subhead + .tl-bullets { margin-top: 6px; }
.tl-term { color: var(--color-text); }

/* Education */
.edu-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--color-divider);
}
.edu-years {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-feature-settings: "tnum" 1;
  padding-top: 6px;
}
.edu-row h3 {
  font-weight: 600;
  font-size: 23px;
  line-height: 1.2;
  margin: 0 0 4px;
}
.edu-school {
  font-size: 15px;
  color: var(--color-accent-text);
  margin: 0 0 6px;
}
.edu-note {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-muted);
  max-width: 70ch;
}
.edu-note + .edu-note { margin-top: 8px; }
.edu-school + .tl-subhead { margin-top: 10px; }
.edu-row .tl-bullets { max-width: 70ch; }

/* Projects */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  background: transparent;
}
.card:hover { border-color: var(--accent-tint-40); }
.card-kicker {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent-text);
  line-height: 1.6;
}
.card-title {
  font-weight: 400;
  font-size: 26px;
  line-height: 1.2;
}
.card-body {
  flex: 1;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-muted);
}
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  font-size: 14px;
  margin-top: 4px;
}
.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 4px;
}
.card-links .card-link { margin-top: 0; }

/* Publications */
.pub-list { border-top: 1px solid var(--color-divider); }
.pub-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-divider);
}
.pub-main { font-size: 16px; line-height: 1.5; }
.pub-venue { color: var(--color-text-faint); }
.pub-venue::before { content: "— "; }
.pub-link {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.more-link {
  display: inline-block;
  margin-top: 24px;
  font-size: 15px;
}

/* Highlights */
.highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.highlight-stack { display: flex; flex-direction: column; gap: 24px; }
.highlight h3 {
  font-weight: 600;
  font-size: 20px;
  line-height: 1.2;
  margin: 0 0 8px;
}
.highlight p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--color-text-secondary);
}

/* Contact */
.contact { padding: 72px 0 64px; }
.contact-title {
  font-weight: 400;
  font-size: 30px;
  line-height: 1.25;
  text-wrap: pretty;
  margin: 0 0 22px;
}
.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Footer */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--color-divider);
  font-size: 13px;
  color: var(--color-text-muted);
  font-feature-settings: "tnum" 1;
}

/* ---------- mobile (≤ 720px) ---------- */

@media (max-width: 720px) {
  :root { --nav-height: 64px; }

  .nav { gap: 12px; padding: 12px 20px; }
  .nav-brand { font-size: 18px; }
  .theme-toggle { margin-left: 0; }
  .btn-icon { width: 44px; height: 44px; }
  .menu-toggle { display: inline-flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-divider);
  }
  .menu-open .nav-links { display: flex; animation: fade-in 150ms ease; }
  .nav-links li + li { border-top: 1px solid var(--color-divider); }
  .nav-links a {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 20px;
  }

  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

  .hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
    padding: 36px 0 40px;
  }
  .hero-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  .hero-photo {
    order: -1;
    width: 155px;
    margin-bottom: 28px;
  }
  .hero-kicker { font-size: 12px; margin-bottom: 14px; }
  .hero-name {
    font-size: clamp(30px, 9.2vw, 36px);
    line-height: 1.05;
    margin: 0 0 14px;
  }
  .hero-headline { font-size: 20px; margin-bottom: 10px; }
  .hero-tagline { font-size: 16px; line-height: 1.6; margin-bottom: 22px; }

  .actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
  }
  .actions-primary {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .actions-primary .btn { min-height: 44px; }

  .section { padding: 36px 0; }
  .kicker { font-size: 12px; margin-bottom: 16px; }
  .kicker-tight { margin-bottom: 12px; }
  .kicker-heading { margin-bottom: 6px; }
  .section-title { font-size: 32px; margin-bottom: 28px; }

  /* Narrow columns: justified text opens gaps between words, so align left. */
  .about-text,
  .tl-text,
  .tl-bullets li,
  .edu-note,
  .card-body,
  .highlight p {
    text-align: left;
    hyphens: manual;
  }

  .about-text { font-size: 16px; line-height: 1.65; margin-bottom: 20px; }
  .skills { display: block; margin-top: 20px; }
  .skills dt { font-size: 12px; margin: 10px 0 2px; }
  .skills dt:first-child { margin-top: 0; }
  .skills dd { font-size: 14px; line-height: 1.55; }

  .timeline { padding-top: 20px; }
  .tl-item {
    grid-template-columns: 20px 1fr;
    column-gap: 14px;
    padding-bottom: 32px;
  }
  .tl-marker { grid-column: 1; grid-row: 1 / span 2; }
  .tl-meta {
    grid-column: 2;
    grid-row: 1;
    font-size: 12px;
    padding-top: 0;
    margin-bottom: 6px;
  }
  .tl-place { display: inline; }
  .tl-place::before { content: " · "; }
  .tl-body { grid-column: 2; grid-row: 2; }
  .tl-dot { margin-top: 4px; }
  .tl-line { top: 16px; bottom: -32px; }
  .tl-body h3 { font-size: 22px; margin-bottom: 2px; }
  .tl-org { margin-bottom: 6px; }
  .tl-text { font-size: 15px; line-height: 1.6; }
  .tl-bullets { font-size: 14px; line-height: 1.55; margin-top: 8px; padding-left: 16px; }
  .tl-subhead { font-size: 11px; margin-top: 14px; }
  .tl-subhead + .tl-bullets { margin-top: 4px; }

  .edu-row { display: block; padding: 16px 0; }
  .edu-years { font-size: 12px; padding-top: 0; margin-bottom: 4px; }
  .edu-row h3 { font-size: 21px; margin-bottom: 2px; }
  .edu-school { margin-bottom: 4px; }
  .edu-note { font-size: 14px; line-height: 1.55; }
  .edu-note + .edu-note { margin-top: 6px; }

  .cards { grid-template-columns: 1fr; gap: 14px; }
  .card { padding: 20px; gap: 10px; }
  .card-title { font-size: 24px; }
  .card-body { font-size: 14px; }

  .pub-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "title title" "venue link";
    gap: 4px 12px;
    align-items: baseline;
    padding: 12px 0;
  }
  .pub-main { display: contents; }
  .pub-title { grid-area: title; font-size: 15px; line-height: 1.5; }
  .pub-venue {
    grid-area: venue;
    font-size: 13px;
    font-feature-settings: "tnum" 1;
  }
  .pub-venue::before { content: none; }
  .pub-link { grid-area: link; font-size: 11px; justify-self: end; }
  .more-link { margin-top: 18px; }

  .highlights { grid-template-columns: 1fr; gap: 18px; }
  .highlight-stack { gap: 18px; }
  .highlight h3 { font-size: 19px; margin-bottom: 4px; }
  .highlight p { font-size: 14px; line-height: 1.6; }

  .contact { padding: 40px 0 36px; }
  .contact-title { font-size: 24px; line-height: 1.25; margin-bottom: 16px; }
  .contact-row { flex-direction: column; align-items: stretch; gap: 10px; margin-top: 8px; }
  .contact-row .btn { min-height: 44px; }

  .site-footer {
    flex-direction: column;
    gap: 4px;
    padding: 20px 0 32px;
    font-size: 12px;
  }
}
