/* ─── Fonts ──────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ─── Variables ─────────────────────────────────────────────────── */
:root {
  --accent:        #0F766E;
  --accent-light:  #E6F4F3;
  --bg:            #F9FAFB;
  --surface:       #FFFFFF;
  --text:          #111827;
  --text-muted:    #6B7280;
  --border:        #E5E7EB;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.05);
  --radius:        10px;
  --max-width:     1200px;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

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

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

/* ─── Layout ─────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Header ─────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.site-name span {
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── Page header ────────────────────────────────────────────────── */
.page-header {
  padding: 48px 0 32px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-header .subtitle {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ─── Filter bar ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Projects grid ──────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  padding-bottom: 64px;
}

/* ─── Project card ───────────────────────────────────────────────── */
.project-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.project-card > a {
  display: block;
}

.card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--accent-light);
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.project-card:hover .card-image img {
  transform: scale(1.03);
}

.card-body {
  padding: 18px 20px 20px;
}

.card-year {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ─── Tags ───────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ─── Project page ───────────────────────────────────────────────── */
.project-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 32px 0 28px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}

.back-link:hover { color: var(--accent); }

.back-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.project-header { margin-bottom: 28px; }

.project-header h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 14px;
}

.project-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.project-date {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.hero-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--accent-light);
  margin-bottom: 40px;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ─── Project content (rich text) ────────────────────────────────── */
.project-content {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
}

.project-content h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 40px 0 12px;
  color: var(--text);
}

.project-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 28px 0 8px;
}

.project-content p     { margin-bottom: 18px; }
.project-content ul,
.project-content ol    { margin: 0 0 18px 24px; }
.project-content li    { margin-bottom: 6px; }

.project-content img {
  border-radius: 8px;
  margin: 24px 0;
  width: 100%;
}

.project-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
}

.project-content pre {
  background: #1a1a1a;
  color: #e5e7eb;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 18px;
}

.project-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.875rem;
}

/* ─── Project sections (gallery, downloads, video) ───────────────── */
.project-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.project-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  color: var(--text);
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.gallery-grid img:hover {
  transform: scale(1.02);
  opacity: 0.9;
}

.gallery-grid img.portrait {
  aspect-ratio: auto;
  height: auto;
  object-fit: unset;
}

/* Downloads */
.downloads-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.download-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  width: fit-content;
}

.download-item:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.download-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent);
}

/* Video */
.video-embed {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ─── Lightbox ───────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox.active { display: flex; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  animation: fadeIn 0.2s ease;
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: scaleIn 0.2s ease;
}

.lightbox-img {
  max-width: 80vw;
  max-height: 88vh;
  border-radius: 8px;
  object-fit: contain;
  display: block;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,255,255,0.22);
}

.lightbox-close {
  position: absolute;
  top: -52px;
  right: 0;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ─── Animations ─────────────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes scaleIn { from { transform: scale(0.96); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.project-card {
  animation: fadeIn 0.3s ease both;
}

/* Stagger cards on load */
.project-card:nth-child(1)  { animation-delay: 0.02s }
.project-card:nth-child(2)  { animation-delay: 0.05s }
.project-card:nth-child(3)  { animation-delay: 0.08s }
.project-card:nth-child(4)  { animation-delay: 0.11s }
.project-card:nth-child(5)  { animation-delay: 0.14s }
.project-card:nth-child(6)  { animation-delay: 0.17s }
.project-card:nth-child(7)  { animation-delay: 0.20s }
.project-card:nth-child(8)  { animation-delay: 0.23s }
.project-card:nth-child(9)  { animation-delay: 0.26s }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page-header h1     { font-size: 1.5rem; }
  .project-header h1  { font-size: 1.4rem; }
  .projects-grid      { grid-template-columns: 1fr; gap: 16px; }
  .gallery-grid       { grid-template-columns: repeat(2, 1fr); }
  .lightbox-prev,
  .lightbox-next      { display: none; }
}
