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

/* ─── Custom Fonts ───────────────────────────────────── */
/* Site font: Geist, loaded from Google Fonts in index.html. */

/* Backup fonts (not loaded). Files live in fonts/backup/. To try one,
   move its @font-face out of this comment and point --display / --body
   at it in :root. Open Sans, Cormorant and Inter come from Google Fonts; their URLs
   are in a comment in index.html.

@font-face { font-family: 'CabinetGrotesk'; src: url('../fonts/backup/CabinetGrotesk-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

@font-face { font-family: 'ClashDisplay'; src: url('../fonts/backup/ClashDisplay-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Kola';         src: url('../fonts/backup/Kola-Regular.woff2') format('woff2');         font-weight: 400; font-display: swap; }
@font-face { font-family: 'Boxing';       src: url('../fonts/backup/Boxing-Regular.woff2') format('woff2');       font-weight: 400; font-display: swap; }
@font-face { font-family: 'RX100';        src: url('../fonts/backup/RX100-Regular.woff2') format('woff2');        font-weight: 400; font-display: swap; }

--display: 'Open Sans', system-ui, sans-serif;
--display: 'CabinetGrotesk', system-ui, sans-serif;
--display: 'Cormorant Garamond', Georgia, serif;
--display: 'ClashDisplay', system-ui, sans-serif;
--display: 'Kola', Georgia, serif;
--display: 'Boxing', Georgia, serif;
--display: 'RX100', system-ui, sans-serif;
*/

/* ─── Tokens ─────────────────────────────────────────── */
:root {
  --bg:        #ffffff;
  --text:      #000000;
  --muted:     #6b6b6b;
  --border:    #e6e6e6;
  --subhead:   #4a4a4a;
  --rule:      #bdbdbd;
  --display:   'Geist', system-ui, sans-serif;
  --body:      var(--display);
}

/* Dark mode: set by the toggle in the sidebar (js/main.js) */
:root[data-theme="dark"] {
  --bg:        #0d0d0d;
  --text:      #f2f2f2;
  --muted:     #9a9a9a;
  --border:    #2a2a2a;
  --subhead:   #c4c4c4;
  --rule:      #444444;
}

/* ─── Base ───────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* ─── Cursor ─────────────────────────────────────────── */
/* Small dot everywhere, including links and photos (trial) */
html,
a,
button,
.photo-grid.scatter .photo-item,
.photo-grid.scatter .photo-item.dragging {
  cursor: url('../cursors/dot.svg') 8 8, auto;
}

/* Night mode: the same dot in white */
:root[data-theme="dark"],
:root[data-theme="dark"] a,
:root[data-theme="dark"] button,
:root[data-theme="dark"] .photo-grid.scatter .photo-item,
:root[data-theme="dark"] .photo-grid.scatter .photo-item.dragging {
  cursor: url('../cursors/dot-light.svg') 8 8, auto;
}

/* ─── Section shared ─────────────────────────────────── */
section {
  padding: 4rem 0 6rem;
  max-width: 860px;
}

/* Page title on the subpages ("Work", "Photographs") */
.section-label {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 3.5rem;
}

@media (max-width: 860px) {
  .section-label { font-size: 28px; margin-bottom: 2.5rem; }
}

/* ─── Work ───────────────────────────────────────────── */
.career-summary {
  max-width: 580px;
  margin-bottom: 5rem;
}

.career-summary p {
  font-size: 0.975rem;
  line-height: 1.85;
}

.career-summary p + p { margin-top: 1.1rem; }

/* Company name shown in its own lettering. The SVG is used as a mask,
   so it is filled with the text color and stays sharp in both themes. */
.wordmark { color: inherit; text-decoration: none; }
.wordmark-curative {
  display: inline-block;
  height: 0.78em;
  aspect-ratio: 119 / 24.55;
  background: currentColor;
  -webkit-mask: url("../ornaments/curative-wordmark.svg") center / contain no-repeat;
          mask: url("../ornaments/curative-wordmark.svg") center / contain no-repeat;
  transition: opacity 0.2s ease;
}
.wordmark:hover .wordmark-curative { opacity: 0.6; }

/* Company block */
.company {
  margin-bottom: 4rem;
}

.company-header {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.company-header h3 {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.company-note {
  font-size: 0.72rem;
  color: var(--text);
  font-style: italic;
}

/* Projects */
.projects {
  margin-bottom: 4rem;
}

.projects-title {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem 1.5rem;
}

.project-media {
  aspect-ratio: 1 / 1;
  border: 1px dashed var(--rule);
  margin-bottom: 0.9rem;
}

.project-name {
  font-size: 0.95rem;
  font-weight: 400;
  margin-bottom: 0.3rem;
}

.project-desc {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
}

/* Cash Card: a 3D card you can turn by dragging (js/card3d.js) */
.card-stage {
  position: relative;
  border: 0;
  display: grid;
  place-items: center;
  perspective: 900px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}
.card-stage:focus-visible { outline: 1px dashed var(--rule); outline-offset: 4px; }
.card3d {
  --card: url('../projects/cash-card.jpg');
  position: relative;
  width: 86%;
  aspect-ratio: 480 / 302;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 10deg)) rotateY(var(--ry, -20deg));
  will-change: transform;
}
.card-layer {
  position: absolute;
  inset: 0;
  border-radius: 3.6% / 5.7%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.card-front {
  transform: translateZ(0.6px);
  overflow: hidden;
}
.card-front svg { display: block; width: 100%; height: 100%; }
/* light sliding across the plastic as it turns */
.card-front::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.28) 46%, rgba(255,255,255,0) 60%);
  background-size: 250% 100%;
  background-position: var(--glare, 50%) 0;
  mix-blend-mode: screen;
}
.card-edge {
  transform: translateZ(var(--z));
  background: #c4492b;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
}
/* the back: plain orange from the card itself, magnetic stripe, signature panel, logo */
.card-back {
  transform: rotateY(180deg) translateZ(0.6px);
  background: #f25e40;
  overflow: hidden;
}
.card-stripe {
  position: absolute;
  left: 0; right: 0; top: 11%;
  height: 19%;
  background: linear-gradient(#1b1b1b, #2b2b2b 50%, #161616);
}
.card-sign {
  position: absolute;
  left: 7%; top: 40%;
  width: 58%; height: 14%;
  background: repeating-linear-gradient(-45deg, #f4f1ec 0 3px, #e8e3dc 3px 6px);
  border-radius: 2px;
}
.card-logo {
  position: absolute;
  right: 6.5%; bottom: 9%;
  width: 13%;
  aspect-ratio: 1;
  background: var(--card) 95.7% 7.3% / 842% auto no-repeat;
}
.card-logo-front {
  right: auto; bottom: auto;
  left: 84.4%; top: 5.6%;
  width: 11.9%;
}
/* Version 2 card (front redrawn from IMG_2744, back is zerocard.svg) */
.card3d.v2 .card-layer { border-radius: 3.8% / 6%; }
.card3d.v2 .card-edge { background: #b8433a; }
.card3d.v2 .card-back { background: url('../projects/cash-card-v2-back.svg') center / 100% 100% no-repeat; }

.card-shadow {
  position: absolute;
  left: 50%; bottom: 9%;
  width: 70%; height: 8%;
  transform: translateX(-50%) scaleX(var(--shadow, 0.9));
  background: radial-gradient(closest-side, rgba(0,0,0,.28), transparent);
  filter: blur(4px);
  pointer-events: none;
}
:root[data-theme="dark"] .card-shadow { background: radial-gradient(closest-side, rgba(0,0,0,.7), transparent); }
.card-hint {
  position: absolute;
  bottom: 0;
  font-size: 0.68rem;
  color: var(--muted);
  transition: opacity .4s ease;
  pointer-events: none;
}
.card-stage.touched .card-hint { opacity: 0; }

/* Testing van: a 3D model you can turn (js/van3d.js) */
.van-stage {
  position: relative;
  border: 0;
  display: grid;
  place-items: center;
  outline: none;
}
.van-stage:focus-visible { outline: 1px dashed var(--rule); outline-offset: 4px; }
.van-stage canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity .5s ease; }
.van-stage.ready canvas { opacity: 1; }
.van-stage.touched .card-hint { opacity: 0; }

@media (max-width: 860px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1rem; }
}

/* Role */
.role {
  margin-bottom: 2.25rem;
  padding-left: 1.25rem;
  border-left: 1px solid var(--border);
}

.role-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.role-title {
  font-size: 0.875rem;
  font-weight: 400;
}

.role-date {
  font-size: 0.72rem;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.role ul {
  list-style: none;
}

.role ul li {
  position: relative;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.75;
  padding-left: 1rem;
  padding-bottom: 0.15rem;
}

.role ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--border);
  font-size: 0.7rem;
  top: 0.1em;
}

.role p {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.8;
}

/* Subsections (Research, Publications, Education) */
.subsection {
  margin-top: 3.5rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.subsection-title {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 400;
  margin-bottom: 1.75rem;
  color: var(--text);
}

.research-list {
  list-style: none;
}

.research-list li {
  font-size: 0.85rem;
  line-height: 1.9;
}

.research-note { color: var(--muted); }

.publication {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.8;
  max-width: 560px;
}

.publication strong {
  color: var(--text);
  font-weight: 400;
}

.edu-note {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text);
}

/* ─── Photography ────────────────────────────────────── */
#photography,
#marginalia {
  max-width: none;
}

#photography { padding-bottom: 2rem; }

/* Masonry columns so each photo keeps its original frame (no cropping) */
.photo-grid {
  columns: 3;
  column-gap: 1rem;
  max-width: 1280px;
}

.photo-item {
  overflow: hidden;
  break-inside: avoid;
  margin-bottom: 1rem;
}

.photo-item img {
  width: 100%;
  height: auto;
  display: block;
  filter: saturate(0.85);
  transition: filter 0.5s ease, transform 0.5s ease;
}

.photo-item:hover img {
  filter: saturate(1);
  transform: scale(1.015);
}

/* Scattered layout, applied by js/photos.js (columns above are the fallback).
   Photos are positioned freely; the script sets each one's spot and size. */
.photo-grid.scatter {
  columns: auto;
  position: relative;
  margin-bottom: 4rem;
}

.photo-grid.scatter .photo-item {
  position: absolute;
  margin-bottom: 0;
  user-select: none;
}

.photo-grid.scatter .photo-item.dragging {
  box-shadow: 0 18px 40px rgba(27, 25, 22, 0.18);
}

/* Resize handle: a small white dot that appears on hover */
.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26px;
  height: 26px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.resize-handle::after {
  content: '';
  position: absolute;
  right: 9px;
  bottom: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15), 0 0 3px rgba(0, 0, 0, 0.35);
}

/* Resize cursor: a small ring while over the handle or resizing */
.resize-handle,
.photo-grid.scatter .photo-item.resizing {
  cursor: url('../cursors/resize-ring.svg') 12 12, nwse-resize;
}
:root[data-theme="dark"] .resize-handle,
:root[data-theme="dark"] .photo-grid.scatter .photo-item.resizing {
  cursor: url('../cursors/resize-ring-light.svg') 12 12, nwse-resize;
}

.photo-item:hover .resize-handle,
.photo-item.resizing .resize-handle {
  opacity: 1;
}

.photo-grid.scatter .photo-item.resizing {
  box-shadow: 0 18px 40px rgba(27, 25, 22, 0.18);
}

.photo-grid.scatter .photo-item.resizing img {
  transform: none;
}

.photo-grid.scatter .photo-item.dragging img {
  transform: none;
  transition: filter 0.5s ease;
}

/* ─── Marginalia ─────────────────────────────────────── */
.mind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 140px));
  gap: 1.25rem 1rem;
}

.mind-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mind-image-wrap {
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--border);
}

.mind-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.85);
  transition: filter 0.5s ease, transform 0.5s ease;
}

.mind-img--placeholder {
  opacity: 0;
}

.mind-item:hover .mind-img:not(.mind-img--placeholder) {
  filter: saturate(1);
  transform: scale(1.015);
}

.mind-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mind-type {
  font-size: 0.7rem;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.mind-title {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}

@media (max-width: 768px) {
  .mind-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ─── About ──────────────────────────────────────────── */
#about {
  max-width: 640px;
}

.about-content p {
  font-size: 0.975rem;
  line-height: 1.9;
  margin-bottom: 1.4rem;
}

.contact {
  display: flex;
  gap: 2rem;
  margin-top: 2.5rem;
}

.contact a {
  font-size: 0.75rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.contact a:hover {
  color: var(--text);
  border-color: var(--text);
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .photo-grid {
    columns: 1;
  }

  .photo-grid.scatter {
    display: flex;
    flex-direction: column;
    row-gap: 3rem;
  }

  .photo-grid.scatter .photo-item {
    position: relative;
    width: 78%;
    margin-top: 0 !important;
    cursor: auto;
  }

  .resize-handle {
    display: none;
  }

  .photo-grid.scatter .photo-item:nth-child(even) {
    align-self: flex-end !important;
  }

  .photo-grid.scatter .photo-item:nth-child(odd) {
    align-self: flex-start !important;
  }

  .role-header {
    flex-direction: column;
    gap: 0.2rem;
  }

  .company-header {
    flex-direction: column;
    gap: 0.4rem;
  }
}

