/* ===========================================================
   Ryan Sandvik — Portfolio
   Style: Dark Studio · Scheme: Ember (coral)
   =========================================================== */

:root {
  --bg:        #0f1114;   /* page background (near-black)   */
  --surface:   #1a1d21;   /* cards, tiles                  */
  --surface-2: #23272c;   /* hover / raised                */
  --text:      #f4f4f1;   /* primary text                  */
  --text-dim:  #a4a8ad;   /* secondary text                */
  --text-mute: #6f7276;   /* captions, meta                */
  --accent:    #e8623a;   /* Ember coral                   */
  --accent-dim:#b34524;
  --border:    #2a2d31;
  --maxw:      1120px;
  --radius:    10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

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

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15,17,20,0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  font-weight: 600; font-size: 15px; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav { display: flex; gap: 28px; align-items: center; }
.nav a {
  font-size: 14px; color: var(--text-dim);
  transition: color 0.15s ease; position: relative;
}
.nav a:hover, .nav a.active { color: var(--text); }
.nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -22px;
  height: 2px; background: var(--accent);
}

/* ---------- Hero ---------- */
.hero { padding: 88px 0 56px; }
.hero-media {
  width: 100%; aspect-ratio: 21/9; background: var(--surface);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); margin-bottom: 40px;
  display: flex; align-items: center; justify-content: center;
}
.hero-media img, .hero-media video { width: 100%; height: 100%; object-fit: cover; }
.hero-media .placeholder { color: var(--text-mute); font-size: 14px; }
.hero h1 {
  font-size: clamp(40px, 7vw, 76px); font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.0;
}
.hero .tagline {
  margin-top: 14px; font-size: 17px; color: var(--accent);
  letter-spacing: 0.02em;
}
.hero .sub { margin-top: 6px; color: var(--text-dim); font-size: 15px; }

/* ---------- Work grid ---------- */
.section-label {
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-mute); margin: 56px 0 20px;
}
.grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
  padding-bottom: 40px;
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent-dim); }
.card-thumb {
  aspect-ratio: 16/9; background: var(--surface-2);
  position: relative; overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .card-thumb::after {
  content: ""; position: absolute; inset: 0;
  border-bottom: 3px solid var(--accent);
}
.card-thumb .ph {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: var(--text-mute); font-size: 13px;
}
.card-body { padding: 16px 18px 20px; }
.card-year {
  font-size: 12px; font-weight: 500; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 6px;
}
.card-title { font-size: 18px; font-weight: 600; }
.card-meta { margin-top: 4px; font-size: 13px; color: var(--text-dim); }
.card-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px; letter-spacing: 0.03em; padding: 3px 9px;
  border-radius: 100px; background: rgba(232,98,58,0.12);
  color: var(--accent); border: 1px solid rgba(232,98,58,0.25);
}
.tag.neutral {
  background: var(--surface-2); color: var(--text-dim);
  border-color: var(--border);
}

/* ---------- Project detail ---------- */
.detail { padding: 56px 0 40px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text-dim); margin-bottom: 32px;
}
.back-link:hover { color: var(--accent); }
.detail h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 600; letter-spacing: -0.02em; }
.detail-meta {
  margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 20px;
  color: var(--text-dim); font-size: 15px;
}
.detail-meta .role { color: var(--accent); }
.detail-hero {
  margin: 36px 0; aspect-ratio: 16/9; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display:flex; align-items:center; justify-content:center;
}
.detail-hero .ph { color: var(--text-mute); font-size: 14px; }
.detail-body { max-width: 720px; font-size: 17px; color: var(--text-dim); }
.detail-body p { margin-bottom: 20px; }
.contributions { max-width: 720px; margin: 36px 0 8px; }
.contributions h2 {
  font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 16px;
}
.contributions ul { list-style: none; }
.contributions li {
  position: relative; padding-left: 22px; margin-bottom: 12px;
  font-size: 16px; color: var(--text-dim); line-height: 1.55;
}
.contributions li::before {
  content: ""; position: absolute; left: 0; top: 10px;
  width: 8px; height: 8px; border-radius: 2px; background: var(--accent);
}

.detail-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 100px; font-size: 14px;
  border: 1px solid var(--accent); color: var(--accent);
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--accent); color: #17110d; }
/* Inline video(s) — responsive 16:9, capped so it isn't full-bleed */
.detail-videos { margin-top: 32px; display: grid; gap: 20px; }
.detail-video {
  position: relative; width: 100%; max-width: 760px; aspect-ratio: 16/9;
  background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
.detail-video iframe, .detail-video video {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

/* Featured media (e.g. diagrams) — full width, kept legible */
.detail-featured { margin-top: 40px; display: grid; gap: 20px; }
.detail-featured img, .detail-featured .ph {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--border);
}
.detail-featured .ph {
  aspect-ratio: 16/9; background: var(--surface); display:flex;
  align-items:center; justify-content:center; color: var(--text-mute); font-size: 13px;
}

/* Screenshot gallery — grid so it doesn't compete with the hero */
.detail-gallery {
  margin-top: 12px; display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.detail-gallery .shot {
  display: block; padding: 0; margin: 0; border: 0; background: none;
  line-height: 0; cursor: pointer; width: 100%;
}
.detail-gallery .shot img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--border);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.detail-gallery .shot:hover img { border-color: var(--accent-dim); transform: translateY(-2px); }
.detail-gallery .shot:focus-visible img { border-color: var(--accent); outline: none; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center;
  background: rgba(8, 9, 11, 0.92); padding: 40px;
}
.lightbox.open { display: flex; }
.lb-img {
  max-width: min(1200px, 92vw); max-height: 88vh;
  border-radius: 8px; border: 1px solid var(--border); object-fit: contain;
}
.lb-close, .lb-nav {
  position: absolute; background: rgba(26, 29, 33, 0.85); color: var(--text);
  border: 1px solid var(--border); border-radius: 100px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease; line-height: 1;
}
.lb-close:hover, .lb-nav:hover { background: var(--surface-2); border-color: var(--accent-dim); }
.lb-close { top: 20px; right: 24px; width: 42px; height: 42px; font-size: 20px; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 30px; }
.lb-prev { left: 20px; } .lb-next { right: 20px; }
.lb-count {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  color: var(--text-dim); font-size: 13px; letter-spacing: 0.04em;
}
@media (max-width: 560px) {
  .lightbox { padding: 16px; }
  .lb-nav { width: 44px; height: 44px; font-size: 26px; }
  .lb-prev { left: 8px; } .lb-next { right: 8px; }
}

/* ---------- About ---------- */
.about { padding: 56px 0; }
.about-grid { display: grid; grid-template-columns: 320px 1fr; gap: 48px; align-items: start; }
.about-photo {
  aspect-ratio: 4/5; background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden; display:flex;
  align-items:center; justify-content:center; color: var(--text-mute); font-size: 13px;
}
.about h1 { font-size: 40px; font-weight: 600; margin-bottom: 20px; letter-spacing: -0.01em; }
.about p { font-size: 17px; color: var(--text-dim); margin-bottom: 20px; max-width: 640px; }
.about a { color: var(--accent); }
.about h2 { font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-mute); margin: 32px 0 14px; }
.skills { display: flex; flex-wrap: wrap; gap: 8px; }
.skills span {
  font-size: 13px; padding: 6px 12px; border-radius: 100px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; }
.site-footer .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 80px; flex-wrap: wrap; gap: 12px;
}
.social { display: flex; gap: 20px; }
.social a { color: var(--text-dim); font-size: 14px; transition: color 0.15s ease; }
.social a:hover { color: var(--accent); }
.copyright { color: var(--text-mute); font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .about-photo { max-width: 280px; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .nav { gap: 18px; }
  .hero { padding: 56px 0 40px; }
}
