/* paulwarnick.me
   Warm paper, forest green, soft serif headings. Light and dark themes share
   one set of tokens; components only ever use the tokens. */

/* ---------- Tokens ---------- */

:root {
  --bg: #f6f3ec;
  --bg-alt: #efebe2;
  --card: #fffdf8;
  --ink: #1d2723;
  --ink-2: #47544e;
  --ink-3: #5c6761;
  --rule: #e0d9cc;
  --accent: #2e5e4e;
  --accent-ink: #f6f3ec;
  --accent-soft: #e0e9e2;
  --ember: #b5652c;
  --shadow: 0 1px 2px rgb(29 39 35 / 0.05), 0 8px 24px -12px rgb(29 39 35 / 0.18);

  --font-serif: "Fraunces", ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wrap: 1120px;
  --wrap-wide: 1320px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 16px;
  --radius-sm: 6px;
  --row-h: 280px;
  --gap: 10px;
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0.75, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1512;
    --bg-alt: #121b17;
    --card: #16201b;
    --ink: #e8e4da;
    --ink-2: #b9c2bc;
    --ink-3: #8c9891;
    --rule: #26322c;
    --accent: #8cc3a6;
    --accent-ink: #0e1512;
    --accent-soft: #1b2b24;
    --ember: #e39c63;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px -14px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1512;
  --bg-alt: #121b17;
  --card: #16201b;
  --ink: #e8e4da;
  --ink-2: #b9c2bc;
  --ink-3: #8c9891;
  --rule: #26322c;
  --accent: #8cc3a6;
  --accent-ink: #0e1512;
  --accent-soft: #1b2b24;
  --ember: #e39c63;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px -14px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }

svg {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

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

::selection { background: var(--accent); color: var(--accent-ink); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-wide { max-width: calc(var(--wrap-wide) + var(--gutter) * 2); }

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  color: var(--ink);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}
.site-header.on-hero {
  color: #fff;
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-family: var(--font-serif);
  font-variation-settings: "SOFT" 100, "opsz" 40;
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  margin-right: auto;
}

.nav { display: flex; align-items: center; }
.nav-list { display: flex; gap: 4px; }
.nav-list a {
  display: block;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  opacity: 0.86;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}
.nav-list a:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.icon-btn svg { width: 20px; height: 20px; }

.nav-toggle { display: none; }

.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-grid; }
  .nav-list {
    position: absolute;
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px) - 6px);
    right: var(--gutter);
    flex-direction: column;
    min-width: 200px;
    padding: 8px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  .nav-list.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-list a { padding: 10px 14px; font-size: 1rem; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: min(100svh, 920px);
  display: flex;
  align-items: flex-end;
  color: #fff;
  background: #24332d;
  overflow: hidden;
  isolation: isolate;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  transform: scale(1.04);
  animation: hero-settle 2.2s var(--ease) forwards;
}

@keyframes hero-settle { to { transform: scale(1); } }

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgb(9 15 12 / 0.82) 0%, rgb(9 15 12 / 0.35) 38%, rgb(9 15 12 / 0) 62%),
    linear-gradient(to bottom, rgb(9 15 12 / 0.45) 0%, rgb(9 15 12 / 0) 22%);
}

.hero-content {
  padding-block: calc(var(--header-h) + 48px) clamp(48px, 9vh, 96px);
}

.hero-place {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}
.hero-place::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.hero-name {
  margin-top: 14px;
  font-family: var(--font-serif);
  font-variation-settings: "SOFT" 100, "opsz" 144;
  font-weight: 400;
  font-size: clamp(3.4rem, 10.5vw, 8rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero-tagline {
  margin-top: 18px;
  max-width: 46ch;
  font-size: clamp(1.1rem, 2.1vw, 1.4rem);
  line-height: 1.45;
  opacity: 0.94;
}

.hero .link-row { margin-top: 28px; }
.hero .pill {
  color: #fff;
  border-color: rgb(255 255 255 / 0.35);
  background: rgb(255 255 255 / 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hero .pill:hover { background: rgb(255 255 255 / 0.18); border-color: rgb(255 255 255 / 0.6); }

.hero-credit {
  position: absolute;
  right: var(--gutter);
  bottom: 18px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  opacity: 0.72;
}

.js .hero-content > * {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.9s var(--ease) forwards;
}
.js .hero-content > :nth-child(2) { animation-delay: 0.08s; }
.js .hero-content > :nth-child(3) { animation-delay: 0.18s; }
.js .hero-content > :nth-child(4) { animation-delay: 0.28s; }

@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Pills and links ---------- */

.link-row { display: flex; flex-wrap: wrap; gap: 10px; }
.link-row-center { justify-content: center; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px 10px 15px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease);
}
.pill:hover { border-color: var(--accent); transform: translateY(-1px); }
.pill svg { width: 18px; height: 18px; }

.pill-solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.pill-solid:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }

/* ---------- Sections ---------- */

.section { padding-block: clamp(72px, 11vw, 136px); }
.section-alt { background: var(--bg-alt); }

.split {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 2.3fr);
  gap: clamp(20px, 5vw, 72px);
  align-items: start;
}

.section-title {
  font-family: var(--font-serif);
  font-variation-settings: "SOFT" 100, "opsz" 96;
  font-weight: 400;
  font-size: clamp(2.1rem, 4.2vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.lead {
  font-family: var(--font-serif);
  font-variation-settings: "SOFT" 50, "opsz" 24;
  font-weight: 350;
  font-size: clamp(1.25rem, 2.15vw, 1.6rem);
  line-height: 1.5;
  color: var(--ink);
  max-width: 40ch;
  text-wrap: pretty;
}

/* On wide screens the section title stays beside long sections as you read. */
@media (min-width: 761px) {
  .split > .section-title {
    position: sticky;
    top: calc(var(--header-h) + 40px);
  }
}

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; }
}

/* ---------- Timeline ---------- */

.timeline { position: relative; }

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 24px;
  padding: 0 0 34px 0;
}

/* The line and dot sit in the gap between the date and the role. */
.tl-item::before {
  content: "";
  position: absolute;
  left: calc(7.5rem + 11px);
  top: 12px;
  bottom: -8px;
  width: 1px;
  background: var(--rule);
}
.tl-item:last-child::before { display: none; }

.tl-item::after {
  content: "";
  position: absolute;
  left: calc(7.5rem + 7px);
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1.5px solid var(--ink-3);
}
.tl-item.is-current::after {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}
.tl-item.is-education::after { border-radius: 2px; }

.tl-when {
  padding-top: 2px;
  font-size: 0.88rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  white-space: nowrap;
}
.tl-body { padding-left: 14px; }
.tl-role { font-size: 1.12rem; font-weight: 600; line-height: 1.35; }
.tl-org { color: var(--accent); font-weight: 500; }
.tl-note { margin-top: 2px; color: var(--ink-2); font-size: 0.97rem; }

.tl-tags { margin-top: 8px; }

/* Small label that starts the Education list, set apart from the jobs above. */
.sub-title {
  margin: 18px 0 22px;
  padding-top: 26px;
  border-top: 1px solid var(--rule);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

@media (max-width: 520px) {
  .tl-item { grid-template-columns: 1fr; gap: 2px; padding-left: 28px; }
  .tl-item::before { left: 4px; }
  .tl-item::after { left: 0; }
  .tl-body { padding-left: 0; }
}

/* ---------- Toolbox ---------- */

.toolbox {
  margin-top: 28px;
  padding: 26px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
}
.toolbox-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.toolbox-groups { display: grid; gap: 16px; margin-top: 16px; }
.toolbox-groups > div {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}
.toolbox-groups dt { font-size: 0.92rem; font-weight: 600; color: var(--ink-2); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.87rem;
  line-height: 1.5;
}

@media (max-width: 520px) {
  .toolbox-groups > div { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- Hobbies and photos ----------
   One gallery of justified rows: panoramas end up with a row to themselves and
   portrait shots fill the rows between them. */

.section-photos { padding-bottom: clamp(56px, 8vw, 104px); }

.gallery { --row-h: 320px; margin-top: clamp(40px, 6vw, 72px); }

/* Location caption: slides up on hover or keyboard focus. Touch screens see it
   in the full-screen viewer instead. */
.photo-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px 12px 10px;
  background: linear-gradient(to top, rgb(9 15 12 / 0.7), transparent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.3;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
  pointer-events: none;
}
@media (hover: hover) {
  .photo:hover .photo-caption,
  .photo:focus-visible .photo-caption { opacity: 1; transform: none; }
}

/* Collapsed until "Show all photos" (only when JavaScript can expand it). */
.js .gallery[data-collapsible]:not(.is-expanded) .is-extra { display: none; }
.gallery.fill-last::after { display: none; }
.gallery-more { display: flex; justify-content: center; margin-top: 28px; }
.gallery.is-expanded + .gallery-more { display: none; }

@media (max-width: 900px) { .gallery { --row-h: 220px; } }
@media (max-width: 520px) { .gallery { --row-h: 150px; } }

/* Justified rows: every photo keeps its own shape and each row fills the
   width. Flex-grow is proportional to the aspect ratio, so photos in a row
   end up the same height. The ::after filler stops the last row stretching. */
.justified {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}
.justified::after {
  content: "";
  flex-grow: 1000000;
}

.photo {
  position: relative;
  flex-grow: calc(var(--ar) * 100);
  flex-basis: calc(var(--ar) * var(--row-h));
  aspect-ratio: var(--ar);
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--tone, var(--bg-alt));
  cursor: zoom-in;
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease), opacity 0.5s ease;
}
.photo:hover img { transform: scale(1.035); }
.photo:focus-visible { outline-offset: 2px; border-radius: var(--radius-sm); }

.js .photo img { opacity: 0; }
.js .photo img.is-loaded { opacity: 1; }

@media (max-width: 900px) { :root { --row-h: 210px; } }
@media (max-width: 520px) { :root { --row-h: 150px; --gap: 6px; } }

/* ---------- Contact and footer ---------- */

.contact { background: var(--bg-alt); text-align: center; }
.contact-inner { max-width: 720px; }
.contact .lead { margin: 18px auto 30px; }
.noscript-email { margin-top: 18px; color: var(--ink-2); }

.site-footer {
  padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-3);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--ink); }

/* ---------- Reveal on scroll ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--delay, 0s);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Lightbox ---------- */

html.lb-open { overflow: hidden; }

.lb {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  overflow: hidden;
}
.lb::backdrop { background: transparent; }

.lb-bg {
  position: absolute;
  inset: 0;
  background: rgb(8 12 10 / 0.96);
}

.lb-stage {
  position: absolute;
  inset: 0;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}

.lb-img {
  position: absolute;
  transform-origin: 0 0;
  max-width: none;
  border-radius: 3px;
  box-shadow: 0 20px 60px -20px rgb(0 0 0 / 0.6);
  cursor: grab;
  -webkit-user-drag: none;
}
.lb-img.is-dragging { cursor: grabbing; }

.lb-top {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px 20px;
  background: linear-gradient(to bottom, rgb(8 12 10 / 0.55), transparent);
}
.lb-count {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.lb-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.lb-btn:hover { background: rgb(255 255 255 / 0.18); }
.lb-btn svg { width: 22px; height: 22px; stroke-width: 1.8; }
.lb-btn:focus-visible { outline-color: #fff; }

.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
}
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

.lb-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 24px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.88;
  background: linear-gradient(to top, rgb(8 12 10 / 0.55), transparent);
  pointer-events: none;
}
.lb-caption:empty { display: none; }

.lb-chrome { transition: opacity 0.25s ease; }
.lb.is-dragging .lb-chrome { opacity: 0.3; }

@media (pointer: coarse) {
  .lb-prev, .lb-next { display: none; }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal, .js .hero-content > * { opacity: 1; transform: none; }
  .hero-img { transform: none; }
}
