/* claudiasotomayor.com: one stylesheet for every page. */

/* ---------- Color tokens ---------- */

:root {
  --bg: #ffffff;
  --raised: #ffffff;
  --text: #1f2937;
  --body: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --soft: #f3f4f6;
  --link: #0000ee;
  --accent: #2563eb;
  --nav: rgba(255, 255, 255, 0.82);
  --sun: #f59e0b;
  --moon: #6366f1;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  color-scheme: light;
}

/* Dark theme: set by the toggle (data-theme), or by the system when JS is off. */
:root[data-theme="dark"] {
  --bg: #111827;
  --raised: #374151;
  --text: #f3f4f6;
  --body: #d1d5db;
  --muted: #9ca3af;
  --faint: #6b7280;
  --line: #374151;
  --soft: #1f2937;
  --link: #60a5fa;
  --accent: #60a5fa;
  --nav: rgba(17, 24, 39, 0.82);
  --sun: #fbbf24;
  --moon: #818cf8;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111827;
    --raised: #374151;
    --text: #f3f4f6;
    --body: #d1d5db;
    --muted: #9ca3af;
    --faint: #6b7280;
    --line: #374151;
    --soft: #1f2937;
    --link: #60a5fa;
    --accent: #60a5fa;
    --nav: rgba(17, 24, 39, 0.82);
    --sun: #fbbf24;
    --moon: #818cf8;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, p, figure { margin: 0; }
img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus {
  left: 1rem; top: 1rem; z-index: 100;
  background: var(--bg); padding: 0.5rem 0.75rem; border-radius: 0.4rem; box-shadow: var(--shadow);
}

.wrap { max-width: 42rem; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }

/* ---------- Top bar, icons, theme toggle ---------- */

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.links { display: flex; align-items: center; gap: 1rem; }

.icon-link { display: inline-flex; color: var(--faint); }
.icon-link:hover { color: var(--muted); }
.icon-link svg { width: 1rem; height: 1rem; }

.text-link { font-size: 0.8rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.text-link:hover { color: var(--text); text-decoration: none; }

.toggle {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--soft); border: 1px solid var(--line); border-radius: 0.4rem;
}
.toggle button {
  all: unset;
  box-sizing: border-box; width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 0.3rem; color: var(--muted); cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.toggle button:hover { color: var(--text); }
.toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.toggle svg { width: 14px; height: 14px; }
.toggle [aria-pressed="true"] { background: var(--raised); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.toggle [data-set-theme="light"][aria-pressed="true"] { color: var(--sun); }
.toggle [data-set-theme="dark"][aria-pressed="true"] { color: var(--moon); }

/* Bar that slides in once you scroll past the header */
.sticky {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--nav);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  transform: translateY(-100%); opacity: 0; visibility: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0.3s;
}
.sticky.show {
  transform: none; opacity: 1; visibility: visible;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.sticky-inner {
  max-width: 42rem; margin: 0 auto; padding: 0.7rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.sticky-name { font-weight: 700; white-space: nowrap; }
.sticky-name:hover { color: var(--link); text-decoration: none; }

/* ---------- Home: intro ---------- */

.intro { margin: 5rem 0; }

.id { display: flex; align-items: center; gap: 1rem; margin-bottom: 5rem; }
.avatar {
  width: 4rem; height: 4rem; flex-shrink: 0;
  border-radius: 50%; object-fit: cover; background: var(--soft);
  transition: transform 0.5s ease;
}
.avatar:hover { transform: scale(1.05); }
.id h1 { font-size: 1.125rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.1rem; }
.tagline { font-size: 0.875rem; color: var(--muted); }

.lede p { color: var(--body); line-height: 2; }
.lede p + p { margin-top: 1rem; }
.lede .statement {
  font-size: 1.5rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em;
  color: var(--text); margin-bottom: 1.75rem; text-wrap: balance;
}
.lede .statement + p { margin-top: 0; }

.ext { color: var(--accent); }

.arrow { display: inline-block; color: var(--accent); transition: transform 0.2s ease; }
a:hover .arrow { transform: translate(2px, -2px); }

/* ---------- Home: sections and timeline rows ---------- */

main > section { margin-bottom: 5rem; scroll-margin-top: 4.5rem; }
section > h2 { font-size: 1.125rem; font-weight: 700; margin-bottom: 2rem; }

.rows { display: grid; gap: 2.5rem; }
.rows.tight { gap: 1.25rem; }

.row { display: flex; }
.when {
  width: 25%; flex-shrink: 0; padding: 0.12rem 1rem 0 0;
  font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.what { flex: 1; min-width: 0; }
.what h3 { font-size: 1rem; font-weight: 600; line-height: 1.5; margin-bottom: 0.1rem; }
.role { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.3rem; }
.desc { font-size: 0.875rem; color: var(--body); }
.meta { font-size: 0.8rem; color: var(--muted); }

.more { margin-top: 2.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.875rem; }
.more a { color: var(--accent); font-weight: 500; }

/* ---------- Photography ---------- */

/* Justified rows: each photo grows in proportion to its aspect ratio (--r),
   so every photo in a row shares one height and nothing gets cropped. */
.gallery { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.gallery::after { content: ""; flex-grow: 1000000; }
.shot { flex-grow: calc(var(--r) * 100); flex-basis: calc(var(--r) * 9.5rem); }
.shot a, .shot .ph { display: block; overflow: hidden; border-radius: 0.4rem; background: var(--soft); }
.shot img {
  width: 100%; height: auto; aspect-ratio: var(--r); object-fit: cover;
  transition: transform 0.5s ease;
}
.shot a:hover img { transform: scale(1.03); }
.shot .ph {
  aspect-ratio: var(--r); display: grid; place-items: center;
  color: var(--faint); border: 1px dashed var(--line);
}
.shot .ph svg { width: 1.4rem; height: 1.4rem; opacity: 0.7; }
.gallery-note { margin-top: 1rem; font-size: 0.8rem; color: var(--muted); }

/* Full-screen photo viewer */
.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: #f9fafb;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgba(8, 8, 10, 0.95); }
.lightbox figure { display: grid; justify-items: center; gap: 0.75rem; }
.lightbox img {
  width: auto; height: auto; max-width: min(92vw, 100%); max-height: 84vh;
  object-fit: contain; border-radius: 0.25rem;
}
.lightbox figcaption { min-height: 1.3em; font-size: 0.85rem; color: #d1d5db; text-align: center; }
.lb-btn {
  all: unset;
  position: fixed; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: #f9fafb; cursor: pointer;
  transition: background-color 0.2s ease;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.18); }
.lb-btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.lb-btn svg { width: 20px; height: 20px; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }
html:has(.lightbox[open]) { overflow: hidden; }

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

.prose p { color: var(--body); line-height: 1.8; }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

.foot { font-size: 0.8rem; color: var(--muted); }

/* ---------- Writing: single post ---------- */

.back { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
.back:hover { color: var(--text); text-decoration: none; }
.back svg { width: 1rem; height: 1rem; transition: transform 0.2s ease; }
.back:hover svg { transform: translateX(-2px); }

.post { margin: 3.5rem 0 4rem; }
.post h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.25; margin-bottom: 0.6rem; }
.post-meta { font-size: 0.875rem; color: var(--muted); margin-bottom: 2.5rem; }
.post-meta .dot { margin: 0 0.5rem; }

.post-body { color: var(--body); }
.post-body > * { margin: 0 0 1.25rem; }
.post-body p, .post-body li { line-height: 1.85; }
.post-body h2 { font-size: 1.25rem; line-height: 1.35; color: var(--text); margin: 2.25rem 0 0.75rem; }
.post-body h3 { font-size: 1.05rem; color: var(--text); margin: 1.75rem 0 0.5rem; }
.post-body a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.post-body ul, .post-body ol { padding-left: 1.25rem; }
.post-body blockquote { margin-left: 0; padding-left: 1rem; border-left: 3px solid var(--line); color: var(--muted); font-style: italic; }
.post-body blockquote > :last-child { margin-bottom: 0; }
.post-body img { border-radius: 0.4rem; }
.post-body figcaption { margin-top: 0.5rem; font-size: 0.8rem; color: var(--muted); text-align: center; }
.post-body hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.post-body code { font-size: 0.85em; background: var(--soft); padding: 0.1em 0.35em; border-radius: 0.25rem; }

.post-more { padding-top: 2rem; border-top: 1px solid var(--line); margin-bottom: 3rem; }
.post-more h2 { font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-bottom: 1rem; }
.post-more ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.post-more a { color: var(--body); }
.post-more a:hover { color: var(--accent); }
.post-more .meta { margin-left: 0.4rem; }

/* ---------- Resume page ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem; border: 1px solid var(--line); border-radius: 0.4rem;
  font-size: 0.8rem; font-weight: 600; color: var(--text); background: var(--bg);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn svg { width: 0.9rem; height: 0.9rem; }

.cv { margin: 3.5rem 0 4rem; }
.cv > section { margin-bottom: 0; }
.cv-head { position: relative; }
.cv-head h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.cv-head .tagline { font-size: 1rem; margin-top: 0.2rem; }
.cv-social { position: absolute; top: 0.45rem; right: 0; display: flex; gap: 0.8rem; }
.cv-social svg { width: 1.1rem; height: 1.1rem; }
.cv-contact {
  display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem;
  margin: 0.75rem 0 0; padding: 0; list-style: none;
  font-size: 0.85rem; color: var(--muted);
}
.cv-contact li + li::before { content: "·"; margin-right: 0.6rem; color: var(--faint); }
.cv-contact a:hover { color: var(--accent); }

.cv h2 { font-size: 1.125rem; font-weight: 700; margin: 2.75rem 0 1rem; }
.cv p, .cv li { font-size: 0.9rem; line-height: 1.7; color: var(--body); }

.job { margin-bottom: 1.9rem; }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.job-head h3 { font-size: 1rem; font-weight: 600; line-height: 1.45; }
.dates { font-size: 0.85rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.org { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.875rem; font-style: italic; color: var(--muted); }
.org .loc { font-style: normal; white-space: nowrap; }
.org a:hover { color: var(--accent); }
.job .blurb { margin-top: 0.35rem; }
.job ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.job li + li { margin-top: 0.3rem; }
.honors { margin: 0; padding-left: 1.1rem; }
.honors li + li { margin-top: 0.3rem; }
.print-only { display: none; }

.skills { display: grid; grid-template-columns: 9.5rem 1fr; gap: 0.55rem 1rem; margin: 0; font-size: 0.9rem; }
.skills dt { font-weight: 600; color: var(--text); }
.skills dd { margin: 0; color: var(--body); line-height: 1.6; }

/* ---------- Scroll-in animation ---------- */

/* Hidden only when JS is running (theme.js adds .js). If main.js never loads,
   the failsafe animation shows everything after two seconds. */
.js .reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.js:not(.reveal-live) .reveal { animation: reveal-failsafe 0.6s ease-out 2s forwards; }
.js .reveal.in { opacity: 1; transform: none; }
.js .intro.reveal { transition-delay: 0.1s; }
@keyframes reveal-failsafe { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; animation: none; }
  .avatar, .shot img, .arrow { transition: none; }
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .wrap { padding: 1rem 1rem 2.5rem; }
  .sticky-inner { padding: 0.6rem 1rem; }
  .sticky-name { font-size: 0.95rem; }
  .sticky .icon-link { display: none; }
  .links { gap: 0.8rem; }
  .intro { margin: 3rem 0 4rem; }
  .id { margin-bottom: 2.25rem; }
  .lede .statement { font-size: 1.3rem; margin-bottom: 1.25rem; }
  main > section { margin-bottom: 4rem; }
  section > h2 { margin-bottom: 1.25rem; }
  .rows { gap: 1.75rem; }
  .rows.tight { gap: 1rem; }
  .row { flex-direction: column; }
  .when { width: auto; padding: 0; font-size: 0.8rem; }
  .shot { flex-basis: calc(var(--r) * 6.5rem); }
  .post, .cv { margin-top: 2.5rem; }
  .post h1, .cv-head h1 { font-size: 1.5rem; }
  .job-head, .org { flex-direction: column; gap: 0; }
  .skills { grid-template-columns: 1fr; gap: 0.1rem; }
  .skills dd { margin-bottom: 0.65rem; }
  .lb-prev, .lb-next { top: auto; bottom: 1rem; transform: none; }
}

/* ---------- Print (also used to make the resume PDF) ---------- */

@media print {
  @page { size: Letter; margin: 0.35in 0.55in; }

  :root, :root[data-theme="dark"] {
    --bg: #fff; --raised: #fff; --text: #1d1d1f; --body: #2b2b2b;
    --muted: #555; --faint: #888; --line: #d4d4d4; --soft: #f3f3f3;
    --link: #1d1d1f; --accent: #1d1d1f;
    color-scheme: light;
  }
  html { font-size: 10pt; }
  body { background: #fff; }
  .topbar, .sticky, .foot, .skip, .no-print, .lightbox { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .js .reveal { opacity: 1 !important; transform: none !important; animation: none !important; }
  a { text-decoration: none !important; }

  .cv { margin: 0; }
  .cv-head h1 { font-size: 21pt; font-weight: 600; letter-spacing: 0.2px; }
  .cv-head .tagline { font-size: 10.5pt; color: #3a6b4c; font-weight: 500; margin-top: 1px; }
  .cv-contact { font-size: 9pt; color: #555; margin-top: 3px; gap: 0 7px; }
  .cv-contact li + li::before { margin-right: 7px; color: #aaa; }
  .cv-social { top: 4px; gap: 10px; }
  .cv-social .icon-link { color: #3a6b4c; }
  .cv-social svg { width: 18px; height: 18px; }
  .cv h2 {
    font-size: 8.8pt; letter-spacing: 1.6px; text-transform: uppercase; color: #3a6b4c;
    border-bottom: 1px solid #cfd8d2; padding-bottom: 2px; margin: 7px 0 4px;
  }
  .cv p, .cv li { font-size: 9.3pt; line-height: 1.3; color: #2b2b2b; }
  .job { margin-bottom: 4px; }
  .job-head h3 { font-size: 10pt; }
  .dates { font-size: 9pt; }
  .org { font-size: 9.2pt; color: #444; }
  .job-head, .org { break-after: avoid; }
  .job .blurb { margin-top: 2px; }
  .job ul { margin-top: 2px; padding-left: 14px; }
  .job li + li { margin-top: 1px; }
  .job ul.print-only { display: block; }
  .org span.print-only { display: inline; }
  .honors { padding-left: 14px; }
  .honors li + li { margin-top: 1px; }
  li { break-inside: avoid; }
  .skills { grid-template-columns: 1.45in 1fr; gap: 2px 10px; font-size: 9.3pt; }
  .skills dt, .skills dd { line-height: 1.3; }
}
