/* ------------------------------------------------------------------
   Kellan Stanner — portfolio styles
   Colors are defined once below; change them here to restyle the site.
------------------------------------------------------------------- */
:root {
  --bg: #0a0a0a;
  --panel: #111111;
  --fg: #ebebe8;
  --soft: #b4b4af;
  --muted: #7d7d79;
  --line: #222222;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --pad: clamp(20px, 4vw, 48px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.6 -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

/* ---------- header / nav ---------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px 24px;
  padding: 28px var(--pad);
}
.brand {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
}
.site-nav { display: flex; gap: clamp(18px, 3vw, 36px); }
.site-nav a {
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
.site-nav a:hover { color: var(--fg); }
.site-nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--fg); }

/* ---------- page layout ---------- */
main.page {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--pad) 80px;
}
.page-head { padding: clamp(24px, 6vw, 72px) 0 clamp(28px, 4vw, 48px); }
.eyebrow {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.page-head h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.page-head p { max-width: 40rem; margin-top: 16px; color: var(--soft); }

.site-footer {
  padding: 28px var(--pad);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

/* ---------- home ---------- */
main.home {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(48px, 9vw, 120px) var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.home .name {
  font-size: clamp(2.6rem, 9vw, 6.4rem);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.02em;
}
.bio {
  max-width: 36rem;
  margin-top: clamp(24px, 4vw, 40px);
  color: var(--soft);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  font-weight: 300;
  line-height: 1.7;
}
.index { margin-top: clamp(48px, 8vw, 96px); border-top: 1px solid var(--line); }
.index a {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: padding 0.3s var(--ease);
}
.index a:hover { padding-left: 12px; }
.index .num { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.14em; }
.index .label { font-size: 1.15rem; font-weight: 300; letter-spacing: 0.06em; }
.index .note { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- flip tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 1.6vw, 22px);
  max-width: 720px;
  padding: 0;
  list-style: none;
}
@media (min-width: 1000px) {
  .tiles { grid-template-columns: repeat(2, 1fr); max-width: none; }
}

.tile { position: relative; aspect-ratio: 4 / 3; perspective: 1600px; }
@media (max-width: 620px) { .tile { aspect-ratio: 4 / 5; } }
.tile-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.8s var(--ease);
}
.tile.flipped .tile-inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 2px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* front: photo with title over it */
.flip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #161616;
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.flip img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.72) saturate(0.85);
  transition: filter 0.5s, transform 0.8s var(--ease);
}
.flip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0) 55%);
  pointer-events: none;
}
.flip:hover img { filter: brightness(0.9) saturate(1); transform: scale(1.03); }
/* One type style for the title on both sides of the tile */
.flip .title,
.back h2 {
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--fg);
  text-transform: none;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.55);
}
.flip .title {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 20px;
  z-index: 1;
}

/* back: the same photo, blurred and darkened, with the description on top */
.back {
  background: #101010;
  border: 1px solid var(--line);
  transform: rotateY(180deg);
  cursor: pointer;
}
.back .bg {
  position: absolute;
  inset: -24px;
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  max-width: none;
  object-fit: cover;
  filter: blur(18px) brightness(0.26) saturate(0.8);
}
.back-content {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: clamp(18px, 2.4vw, 30px);
}
.back-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.back h2 { padding-right: 8px; }
.close {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--soft);
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}
.close:hover { color: var(--fg); }
.meta {
  margin-top: 8px;
  color: #a8a8a3;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.desc {
  margin-top: 14px;
  min-height: 0;
  overflow: auto;
  color: #d2d2cd;
  font-size: clamp(0.82rem, 1.05vw, 0.95rem);
  line-height: 1.6;
}
.links { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: auto; padding-top: 14px; }
.open {
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--fg);
  color: var(--fg);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.2s;
}
.open:hover { opacity: 0.65; }

/* per-tile adjustments for artwork that needs it */
.tile--dim .flip img { filter: brightness(0.5) saturate(0.7); }
.tile--dim .flip:hover img { filter: brightness(0.66) saturate(0.85); }
.tile--title-right .flip .title { left: 46%; right: 22px; text-align: right; }

@media (prefers-reduced-motion: reduce) {
  .tile-inner, .flip img { transition: none; }
  .tile.flipped .tile-inner { transform: none; }
  .face { backface-visibility: visible; -webkit-backface-visibility: visible; transition: opacity 0.2s; }
  .back { transform: none; opacity: 0; }
  .tile.flipped .back { opacity: 1; }
  .tile.flipped .front { opacity: 0; }
}

/* ---------- photo stream: 3 columns ---------- */
.stream {
  column-count: 3;
  column-gap: clamp(10px, 1.6vw, 22px);
}
@media (max-width: 700px) { .stream { column-count: 2; } }
.stream figure {
  break-inside: avoid;
  margin: 0 0 clamp(10px, 1.6vw, 22px);
}
.stream img {
  width: 100%;
  height: auto;
  background: #141414;
}
.stream figcaption { margin-top: 8px; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.08em; }
.empty { column-span: all; color: var(--muted); }

/* ---------- home: portrait + bio ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px);
  gap: clamp(28px, 6vw, 80px);
  align-items: end;
}
.portrait { order: 2; }
.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 20%;
  border-radius: 2px;
  filter: saturate(0.9) brightness(0.95);
}
.hero-text { order: 1; }
.hero-text .bio { margin-top: clamp(20px, 3vw, 32px); }
.resume-link {
  display: inline-block;
  margin-top: clamp(24px, 3vw, 36px);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--fg);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.2s;
}
.resume-link:hover { opacity: 0.65; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .portrait { order: 0; max-width: 240px; }
  .hero-text { order: 1; }
}
