/* Deepit Magee — personal site
   Palette verified for WCAG contrast on the paper background:
   ink 16.6:1, muted 5.8:1, accent 6.2:1 (light); ink 15.5:1, muted 6.9:1, accent 7.6:1 (dark).
   Type: one serif for everything readable, monospace for dates, stacks and labels only. */

:root {
  color-scheme: light dark;

  --paper: oklch(0.985 0.006 85);
  --ink:   oklch(0.22 0.012 60);
  --muted: oklch(0.50 0.012 60);
  --rule:  oklch(0.88 0.008 80);
  --accent: oklch(0.50 0.16 32);

  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 34rem;   /* prose column */
  --wide: 46rem;      /* the whole page */

  --space: clamp(1.5rem, 1rem + 1.5vw, 2.75rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: oklch(0.19 0.008 70);
    --ink:   oklch(0.94 0.008 85);
    --muted: oklch(0.70 0.012 80);
    --rule:  oklch(0.31 0.01 75);
    --accent: oklch(0.74 0.13 40);
  }
}

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

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

body {
  margin: 0;
  padding: 0 clamp(1.25rem, 5vw, 3rem);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  line-height: 1.65;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums;
  text-rendering: optimizeLegibility;
}

main, .site-head, .site-foot { max-width: var(--wide); margin-inline: auto; }

p, li, h1, h2, h3 { text-wrap: pretty; }

h1, h2, h3 { font-weight: 600; line-height: 1.15; letter-spacing: -0.012em; }

h1 { font-size: clamp(2.75rem, 1.6rem + 5.5vw, 4.5rem); margin: 0.4em 0 0.25em; letter-spacing: -0.022em; }

h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  margin: 0 0 0.5rem;
}

h3 { font-size: 1.0625rem; margin: 0 0 0.2rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

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

code, .meta, .kicker {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.78em;
  letter-spacing: 0.01em;
}

code { font-size: 0.85em; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--paper); color: var(--ink);
  padding: 0.75rem 1rem; z-index: 10;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---- head ---- */

.site-head {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  align-items: baseline; justify-content: space-between;
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.brand { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

.site-nav { display: flex; gap: 1.25rem; }
.site-nav a {
  color: var(--muted); text-decoration: none;
  font-family: var(--mono); font-size: 0.78rem;
  padding: 0.5rem 0; min-height: 44px; display: inline-flex; align-items: center;
}
.site-nav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; }

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

.hero { padding: clamp(2.5rem, 2rem + 4vw, 5rem) 0 var(--space); }

.kicker { color: var(--muted); margin: 0; text-transform: uppercase; letter-spacing: 0.08em; }

.lede {
  font-size: clamp(1.25rem, 1.1rem + 0.9vw, 1.625rem);
  line-height: 1.35;
  max-width: var(--measure);
  margin: 1.25rem 0 0;
}

.hero-note { max-width: var(--measure); margin: 1.25rem 0 0; color: var(--ink); }

.now { max-width: var(--measure); margin: var(--space) 0 0; border-top: 1px solid var(--rule); }
.now > div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.35rem 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}
.now dt { color: var(--muted); font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.01em; padding-top: 0.15em; }
.now dd { margin: 0; }
.now > div:last-child { border-bottom: 0; }

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

.section { padding: var(--space) 0 0; border-top: 1px solid var(--rule); margin-top: var(--space); }

.section-note { max-width: var(--measure); color: var(--muted); margin: 0.75rem 0 1.75rem; }

.projects { list-style: none; margin: 0; padding: 0; }

.project {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 2rem;
  align-items: baseline;
  padding: 1.15rem 0;
  border-top: 1px solid var(--rule);
}
.project:first-child { border-top: 0; padding-top: 0; }
.project > div { max-width: var(--measure); }
.project p { margin: 0; }
.project p:not(.meta) { color: var(--ink); }
.meta { color: var(--muted); margin: 0; white-space: nowrap; text-align: right; }
.nowrap { white-space: nowrap; }

/* ---- timeline ---- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.35rem 2rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--rule);
}
/* Place the two children explicitly. Without this, a missing date leaves the
   text in the 9rem track and collapses it to a two-word-wide column. */
.timeline li > .meta { grid-column: 1; }
.timeline li > div { grid-column: 2; }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline .meta { text-align: left; padding-top: 0.3em; }
.timeline h3 { font-weight: 600; }
.timeline p { margin: 0; }
.org { color: var(--muted); font-size: 0.9em; margin-bottom: 0.35rem; }
.timeline div > p:last-child { max-width: var(--measure); }

/* ---- sub-blocks: company project, education ---- */

.subblock { margin-top: var(--space); }
.subhead {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.subblock ul { list-style: none; margin: 0; padding: 0; }
.subblock li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 1.5rem;
  align-items: baseline;
  padding: 0.65rem 0;
  border-top: 1px solid var(--rule);
}
.subblock li p { margin: 0; }
.subblock li span { font-weight: 600; }
.subblock li .meta { text-align: right; }
.subnote { max-width: var(--measure); margin: 0.85rem 0 0; }

/* ---- contact ---- */

.contact { list-style: none; margin: 1rem 0 0; padding: 0; }
.contact li { padding: 0.35rem 0; }
.contact a { font-size: 1.0625em; }

/* ---- foot ---- */

.site-foot {
  margin-top: var(--space);
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-foot p { margin: 0; max-width: var(--measure); }

/* ---- narrow screens ---- */

@media (max-width: 34rem) {
  .now > div,
  .project,
  .timeline li,
  .subblock li { grid-template-columns: 1fr; gap: 0.15rem; }
  /* must also undo the explicit column placement, or the text lands in an
     implicit second track and the columns stay side by side */
  .timeline li > .meta,
  .timeline li > div { grid-column: 1; }
  .project .meta, .timeline .meta, .subblock li .meta { text-align: left; padding-top: 0.35rem; }
  .timeline .meta { padding-top: 0; }
  .contact li { padding: 0; }
  .contact a { display: inline-block; padding: 0.5rem 0; }
}

/* ---- motion ---- */

@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) backwards; }
  .hero > *:nth-child(1) { animation-delay: 0.02s; }
  .hero > *:nth-child(2) { animation-delay: 0.06s; }
  .hero > *:nth-child(3) { animation-delay: 0.10s; }
  .hero > *:nth-child(4) { animation-delay: 0.14s; }
  .hero > *:nth-child(5) { animation-delay: 0.18s; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(0.6rem); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---- print ---- */

@media print {
  body { font-size: 12pt; }
  .site-nav, .skip { display: none; }
  a { color: inherit; text-decoration: none; }
  a[href^="mailto:"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  .project, .timeline li, .subblock li { break-inside: avoid; }
}
