/* ================================
   Global styles — Evan Sadler portfolio
   ================================ */

@property --bg {
  syntax: '<color>';
  inherits: true;
  initial-value: #f2f0ea;
}
@property --ink {
  syntax: '<color>';
  inherits: true;
  initial-value: #1c1b18;
}
@property --muted {
  syntax: '<color>';
  inherits: true;
  initial-value: #908d85;
}
@property --secondary {
  syntax: '<color>';
  inherits: true;
  initial-value: #5c5950;
}
@property --rule {
  syntax: '<color>';
  inherits: true;
  initial-value: #c8c5be;
}

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

:root {
  --bg: #f2f0ea;
  --ink: #1c1b18;
  --secondary: #5c5950;
  --muted: #908d85;
  --rule: #b0ada6;
  --rule-sub: rgba(0,0,0,0.13);
  --hover: rgba(0,0,0,0.03);
}

[data-theme="dark"] {
  --bg: #0a0a09;
  --ink: #e5e3dd;
  --secondary: #a8a59f;
  --muted: #6a6763;
  --rule: #525050;
  --rule-sub: rgba(255,255,255,0.10);
  --hover: rgba(255,255,255,0.02);
}

/* Page load */
body { opacity: 0; transition: opacity 0.6s ease; }
body.loaded { opacity: 1; }

/* Layout */
html { overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  padding: 88px 80px 120px;
  font-family: "Source Serif 4", Georgia, serif;
  overscroll-behavior: none;
  overflow-x: clip;
}
@media (max-width: 640px) { body { padding: 40px 24px 48px; } .identity { margin-bottom: 40px; } }


.wrap { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; }
@media (min-width: 641px) { .wrap { min-height: calc(100vh - 184px); min-height: calc(100dvh - 184px); } }
@media (min-width: 1024px) { .wrap { zoom: 1.1; } }
.wrap-inner { flex: 1; }

/* Identity */
.pfp {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex-shrink: 0;
  background: url('headshot.png') center/cover;
  transition: width 0.25s ease, height 0.25s ease;
  pointer-events: none;
  cursor: default;
}

.identity {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 64px;
  position: sticky;
  top: 0;
  z-index: 40;
  pointer-events: none;
}
.identity .theme-toggle,
.identity .pfp { pointer-events: auto; }
.id-text {
  transition: opacity 0.2s 0.25s ease;
}
body.identity-collapsed .pfp {
  width: 40px;
  height: 40px;
  cursor: pointer;
  pointer-events: auto;
  transition: width 0.25s 0.2s ease, height 0.25s 0.2s ease;
}
body.identity-collapsed .id-text {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.id-name {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.2;
  font-optical-sizing: auto;
  margin-bottom: 3px;
}
.id-title {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.6;
}

/* Theme toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  cursor: pointer;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--rule-sub);
  border-radius: 50%;
  padding: 0;
  color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  position: relative;
  transition: border-color 0.15s ease, color 0.15s ease;
}
@media (hover: hover) { .theme-toggle:hover { border-color: var(--ink); color: var(--ink); } }
.theme-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sun, .icon-moon, .icon-auto { position: absolute; transition: opacity 0.15s ease; }
.icon-auto { opacity: 1; }
.icon-sun { opacity: 0; }
.icon-moon { opacity: 0; }
[data-theme-mode="light"] .icon-auto { opacity: 0; }
[data-theme-mode="light"] .icon-sun { opacity: 1; }
[data-theme-mode="dark"] .icon-auto { opacity: 0; }
[data-theme-mode="dark"] .icon-moon { opacity: 1; }
@keyframes theme-pop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* Back nav */
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--secondary);
  margin-bottom: 56px;
  font-family: "Space Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border: 1px solid var(--rule-sub);
  border-radius: 999px;
  padding: 6px 12px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
@media (hover: hover) { .back:hover { color: var(--ink); border-color: var(--ink); } }


/* Utility */
.mono {
  font-family: "Space Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 11px;
  color: var(--muted);
  line-height: 2;
}

/* Case study: page header */
.pg-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(32px, 5vw, 50px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-bottom: 18px;
  font-optical-sizing: auto;
}
.pg-tags {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 16px;
  font-weight: 400;
  font-style: italic;
  color: var(--secondary);
  line-height: 1.6;
  margin-bottom: 52px;
  font-optical-sizing: auto;
}
.pg-hint {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 16px;
  font-weight: 400;
  font-style: italic;
  font-optical-sizing: auto;
  color: var(--secondary);
  text-align: left;
  margin-top: 8px;
  margin-bottom: 40px;
}

/* Case study: dividers & labels */
.rule { border: none; border-top: 1px solid var(--rule); margin: 48px -16px; }
.section-label {
  display: block;
  font-family: "Space Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Case study: body text */
.body-text {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink);
  font-optical-sizing: auto;
}
.body-text p { margin-bottom: 1.4em; }
.body-text p:last-child { margin-bottom: 0; }
.body-text em { font-style: italic; color: var(--muted); }

/* Full-width media that breaks out of .col */
.media-break { margin: 48px 0; }

/* Visually hidden — readable by screen readers and reader mode, invisible on page */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Spacing utilities */
.mt-24 { margin-top: 24px; }
.mb-32 { margin-bottom: 32px; }
.mb-40 { margin-bottom: 40px; }


/* ================================
   Lightbox overlay
   ================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.lightbox.open {
  opacity: 1;
  pointer-events: all;
}
.lightbox-image-wrap {
  max-width: 100vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-image-wrap img {
  display: block;
  max-width: 100vw;
  max-height: 80vh;
  object-fit: contain;
}
@media (min-width: 641px) {
  .lightbox-image-wrap { max-width: min(1120px, 90vw); }
  .lightbox-image-wrap img { max-width: min(1120px, 90vw); }
}
.lightbox-controls {
  display: flex;
  gap: 16px;
  margin-top: 32px;
}
.lightbox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.3);
  font-family: "Space Mono", monospace;
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}
.lightbox-btn:hover {
  border-color: rgba(255,255,255,0.8);
  color: #fff;
}
