:root {
  color-scheme: light;
  --paper: #fbf7ee;
  --ink: #25231f;
  --muted: #716c63;
  --line: #d9d0c0;
  --yellow: #f4c84a;
  --blue: #315b96;
  --white: #fffdf8;
  --soft-surface: #efe7d8;
  --tag-surface: #e7dfcf;
  --placeholder-surface: #f4eddf;
  --card-shadow: rgba(60, 49, 33, .1);
  --photo-shadow: rgba(60, 49, 33, .08);
  --portrait-shadow: rgba(74, 61, 39, .16);
  --portrait-ring: var(--yellow);
  --wordmark-filter: brightness(0) saturate(100%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1e1e2e;
  --ink: #cdd6f4;
  --muted: #a6adc8;
  --line: #45475a;
  --yellow: #cba6f7;
  --blue: #b4befe;
  --white: #313244;
  --soft-surface: #36384a;
  --tag-surface: #45475a;
  --placeholder-surface: #181825;
  --card-shadow: rgba(0, 0, 0, .28);
  --photo-shadow: rgba(0, 0, 0, .24);
  --portrait-shadow: rgba(0, 0, 0, .36);
  --portrait-ring: #89b4fa;
  --wordmark-filter: brightness(0) saturate(100%) invert(86%) sepia(10%) saturate(976%) hue-rotate(195deg) brightness(102%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  line-height: 1.6;
  transition: background-color .25s ease, color .25s ease;
}

a { color: inherit; }
img { display: block; max-width: 100%; }

.site-header,
main,
footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  text-decoration: none;
}
.wordmark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: var(--wordmark-filter);
  opacity: .9;
  transition: transform .2s;
}
.wordmark:hover img { transform: rotate(-3deg) scale(1.06); }
nav { display: flex; gap: 28px; }
nav a { color: var(--muted); font-size: .9rem; text-decoration: none; }
nav a:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 24px; }
.theme-toggle {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--white);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background-color .2s ease;
}
.theme-toggle:hover { transform: translateY(-2px) rotate(-5deg); border-color: var(--muted); }
.theme-toggle:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.theme-icon { position: absolute; width: 18px; height: 18px; transition: transform .25s ease, opacity .2s ease; }
.theme-icon-sun { opacity: 0; transform: rotate(-45deg) scale(.5); }
:root[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: rotate(45deg) scale(.5); }
:root[data-theme="dark"] .theme-icon-sun { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.hero {
  min-height: 680px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: 64px;
}

h1, h2 {
  margin: 0;
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  line-height: .95;
}
h1 { font-size: clamp(4rem, 8vw, 7.2rem); letter-spacing: -.04em; }
h2 { font-size: clamp(2.6rem, 5vw, 4.5rem); letter-spacing: -.03em; }
h3 { margin: 0; font-size: 1.25rem; }

.intro {
  max-width: 610px;
  margin: 28px 0;
  color: var(--muted);
  font-size: 1.08rem;
}
.intro strong { color: var(--ink); font-weight: 600; }

.socials { display: flex; gap: 10px; }
.socials a {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  transition: transform .2s, background .2s;
}
.socials a:hover { transform: translateY(-3px); background: var(--yellow); }
.socials svg { width: 19px; }

.tiny-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
  color: var(--muted);
  font-size: .82rem;
}
.tiny-note svg { width: 14px; }

.portrait-wrap { position: relative; padding: 42px; }
.portrait {
  position: relative;
  aspect-ratio: 1;
  object-fit: cover;
  border: 10px solid var(--white);
  border-radius: 44% 56% 48% 52% / 55% 42% 58% 45%;
  box-shadow: 0 22px 50px var(--portrait-shadow);
  transform: rotate(2deg);
}
.sun {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--portrait-ring);
  opacity: .72;
}

.section { padding: 110px 0; border-top: 1px solid var(--line); }
.section-heading { max-width: 590px; margin-bottom: 48px; }

.club-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 26px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x proximity;
}
.club-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  scroll-snap-align: start;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
.club-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px var(--card-shadow); }
.club-card:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }
.club-media { position: relative; height: 250px; overflow: hidden; }
.club-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.club-card:hover .club-photo { transform: scale(1.025); }
.club-logo {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 64px;
  height: 64px;
  object-fit: contain;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 5px 18px rgba(20, 19, 17, .18);
}
.club-logo-wide { width: 78px; }
.club-logo-banner { width: 128px; }
.club-card > .club-copy { position: relative; padding: 26px; }
.club-card h3 { display: flex; align-items: center; gap: 6px; }
.club-card h3 svg { width: 17px; height: 17px; color: var(--blue); }
.club-card p { max-width: 430px; margin-bottom: 0; color: var(--muted); }
.club-card .club-role {
  margin: 4px 0 10px;
  color: var(--blue);
  font: 600 .85rem "Courier New", monospace;
}

.projects { display: block; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; }
.project-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.project-card:hover, .project-card:focus-within { transform: translateY(-3px); box-shadow: 0 14px 30px var(--card-shadow); }
.project-open {
  position: absolute;
  z-index: 3;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}
.project-open:focus-visible { outline: 3px solid var(--yellow); outline-offset: -4px; }
.project-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--placeholder-surface);
}
.project-images, .project-shot { position: absolute; inset: 0; width: 100%; height: 100%; }
.project-shot { object-fit: cover; }
.project-media-crossfade > .project-shot { animation: project-crossfade 12s linear infinite; }
.project-media-crossfade > .project-shot:nth-child(2) { animation-delay: -6s; }
@keyframes project-crossfade {
  0%, 42% { opacity: 1; }
  50%, 92% { opacity: 0; }
  100% { opacity: 1; }
}
.project-logo {
  position: absolute;
  z-index: 2;
  left: 18px;
  bottom: 18px;
  width: 60px;
  height: 60px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 5px 18px rgba(20,19,17,.18);
  object-fit: contain;
}
.project-logo-wide { width: 200px; }
.project-logo-alpine { width: 116px; }
.project-video-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}
.project-video-fallback { opacity: 0; }
.project-copy { display: grid; align-content: start; gap: 10px; padding: 24px; }
.project-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-heading svg { width: 18px; height: 18px; color: var(--blue); }
.project-role {
  margin: 0;
  color: var(--blue);
  font: 600 .76rem "Courier New", monospace;
}
.project-tagline { margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.55; }
.project-card .tag { justify-self: start; padding: 4px 8px; border-radius: 4px; background: var(--tag-surface); font: .68rem "Courier New", monospace; }

.project-dialog {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: rgba(20, 19, 17, .96);
}
.project-dialog::backdrop { background: rgba(20, 19, 17, .96); }
.project-dialog[open] { display: block; }
.project-dialog-content, .project-dialog-view { min-height: 100%; height: 100%; }
.project-dialog-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
}
.project-dialog-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(0, 0, 0, .3);
}
.project-slide {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  margin: 0;
  display: grid;
  place-self: center;
  place-items: center;
  padding: 68px 28px 82px;
  pointer-events: none;
}
.project-slide[hidden], .project-dialog-controls[hidden] { display: none; }
.project-slide picture { display: contents; }
.project-slide img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  pointer-events: auto;
}
.project-video-slide {
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  height: auto;
  aspect-ratio: 16 / 9;
  padding: 0;
}
.project-video-dialog {
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: auto;
}
.project-dialog-controls {
  position: absolute;
  inset: auto 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.project-dialog-controls > button, .project-dialog-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  color: white;
  background: rgba(20, 19, 17, .7);
  cursor: pointer;
}
.project-dialog-controls > button:hover, .project-dialog-close:hover { background: rgba(255, 255, 255, .2); }
.project-dialog-controls > button:focus-visible, .project-dialog-close:focus-visible, .project-dot:focus-visible, .project-link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.project-dialog-controls svg, .project-dialog-close svg { width: 20px; }
.project-dots { display: flex; align-items: center; gap: 8px; }
.project-dot {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.project-dot::before {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  content: "";
}
.project-dot[aria-current="true"]::before { background: white; }
.project-dialog-details {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  overflow: auto;
  padding: 72px 34px 38px;
  background: var(--white);
}
.project-dialog-logo {
  width: 66px;
  height: 66px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 5px 18px rgba(20,19,17,.18);
  object-fit: contain;
}
.project-dialog-logo-wide { width: 240px; }
.project-dialog-logo-alpine { width: 132px; }
.project-dialog-role, .project-dialog-details > p { margin: 0; }
.project-dialog-role, .project-dialog-context { color: var(--blue); font: 600 .76rem "Courier New", monospace; }
.project-dialog-details h2 {
  max-width: 100%;
  font-size: clamp(2.4rem, 4vw, 4rem);
  overflow-wrap: anywhere;
}
.project-dialog-details > .tag { padding: 4px 8px; border-radius: 4px; background: var(--tag-surface); font: .68rem "Courier New", monospace; }
.project-dialog-context { padding-top: 4px; }
.project-dialog-links { width: 100%; display: grid; gap: 10px; margin-top: auto; padding-top: 14px; }
.project-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
}
.project-link:hover { border-color: var(--blue); }
.project-link svg { width: 17px; }
.project-dialog-close {
  position: fixed;
  z-index: 4;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 245px;
  gap: 18px;
}
.photo, .photo-placeholder { margin: 0; border: 8px solid var(--white); box-shadow: 0 8px 24px var(--photo-shadow); }
.photo { position: relative; overflow: hidden; }
.photo-wide { grid-column: span 2; }
.photo-tall { grid-row: span 2; }
.photo-open {
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.photo-open:focus-visible { outline: 4px solid var(--yellow); outline-offset: -4px; }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.photo:hover img { transform: scale(1.025); }
.photo figcaption {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  padding: 24px 16px 12px;
  color: white;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
  font-size: .82rem;
  pointer-events: none;
}
.photo-placeholder { display: grid; place-items: center; align-content: center; color: var(--muted); border-style: dashed; background: var(--placeholder-surface); }
.photo-placeholder svg { width: 28px; }
.photo-placeholder p { margin: 8px 0 0; font: .75rem "Courier New", monospace; }

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: white;
  background: rgba(20, 19, 17, .96);
}
.lightbox::backdrop { background: rgba(20, 19, 17, .96); }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; }
.lightbox-toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
}
.lightbox-toolbar p { margin: 0; font-size: .85rem; }
.lightbox-actions { display: flex; align-items: center; gap: 8px; }
.lightbox-actions button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  color: white;
  background: rgba(255,255,255,.08);
  cursor: pointer;
}
.lightbox-actions button:hover { background: rgba(255,255,255,.18); }
.lightbox-actions button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.lightbox-actions svg { width: 19px; }
.lightbox-actions output { min-width: 48px; text-align: center; font: .72rem "Courier New", monospace; }
.lightbox-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
}
.lightbox-stage img {
  max-width: 88vw;
  max-height: 78vh;
  object-fit: contain;
  transform: scale(var(--photo-zoom, 1));
  transition: transform .18s ease;
  user-select: none;
}
.lightbox-hint {
  margin: 0;
  padding: 12px 20px 20px;
  color: rgba(255,255,255,.58);
  font: .72rem "Courier New", monospace;
  text-align: center;
}

footer {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
footer a { display: flex; align-items: center; gap: 5px; color: var(--ink); font-weight: 600; }
footer svg { width: 18px; }

@media (min-width: 761px) {
  .project-card:last-child {
    grid-column: 1 / -1;
    width: calc((100% - 26px) / 2);
    justify-self: center;
  }
}

@media (max-width: 760px) {
  nav { display: none; }
  .hero { min-height: auto; grid-template-columns: 1fr; gap: 22px; padding: 80px 0; }
  .portrait-wrap { max-width: 460px; order: -1; padding: 28px; }
  h1 { font-size: clamp(3.8rem, 18vw, 6rem); }
  .section { padding: 78px 0; }
  .project-grid { grid-template-columns: 1fr; }
  .project-dialog { overflow: auto; }
  .project-dialog-content, .project-dialog-view { height: auto; }
  .project-dialog-view { grid-template-columns: 1fr; grid-template-rows: min(58vh, 520px) auto; }
  .project-dialog-stage { min-height: min(58vh, 520px); }
  .project-dialog-details { overflow: visible; padding: 32px 24px 38px; }
  .club-media { height: 240px; }
  .photo-grid { grid-template-columns: 1fr 1fr; grid-auto-rows: 210px; }
  .photo-wide { grid-column: span 2; }
  .photo-tall { grid-row: auto; }
  footer { padding: 45px 0; flex-direction: column; align-items: flex-start; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  .project-media-crossfade > .project-shot { animation: none !important; }
  .project-media-crossfade > .project-shot:not(:first-child) { opacity: 0; }
  .project-video-preview { display: none; }
  .project-video-fallback { opacity: 1; }
}
