/* Site CSS extracted from design system */
/* ============================================================
   FONT
   ============================================================ */
@font-face {
  font-family: "National Park";
  src: url("fonts/NationalPark-VariableVF.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* ============================================================
   TOKENS — CSS custom properties
   ============================================================ */
:root {
  /* color — warm light mode: parchment canvas, deep wood tones */
  --color-bg: #f6f1eb;
  --color-surface: #efe8df;
  --color-text: #2b2420;
  --color-muted: #7a6e63;
  --color-border: #d9cfc3;
  --color-accent: #3d6b4f;
  --color-accent-hover: #2f5440;
  --color-warm: #b5623a;
  --color-warm-soft: rgba(181, 98, 58, 0.12);
  --color-header-bg: #2b2420;
  --color-header-text: #e8ddd0;
  --color-overlay: rgba(43, 36, 32, 0.7);

  /* type */
  --font-sans: "National Park", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;

  /* type scale — slightly generous for editorial feel */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.5rem;
  --text-4xl: 3.5rem;
  --text-hero: clamp(2.5rem, 6vw, 5rem);

  /* space */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;

  /* layout */
  --max-width: 72rem;
  --content-width: 48rem;
}

[data-theme="dark"] {
  --color-bg: #1a1714;
  --color-surface: #242019;
  --color-text: #e8ddd0;
  --color-muted: #9a8e82;
  --color-border: #3a3430;
  --color-accent: #8aab78;
  --color-accent-hover: #a3c192;
  --color-warm: #d4845c;
  --color-warm-soft: rgba(212, 132, 92, 0.15);
  --color-header-bg: #242019;
  --color-header-text: #e8ddd0;
  --color-overlay: rgba(0, 0, 0, 0.75);
}

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

/* ============================================================
   ELEMENTS — default styling for native HTML
   ============================================================ */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.15;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

p {
  margin-bottom: var(--space-md);
  max-width: 38em;
}

small {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--color-accent-hover);
  text-decoration: none;
}

ul, ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}
li { margin-bottom: var(--space-xs); }

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-xl) 0;
}

blockquote {
  border-left: 3px solid var(--color-warm);
  padding-left: var(--space-md);
  color: var(--color-muted);
  margin-bottom: var(--space-md);
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-surface);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-mono);
  background: var(--color-surface);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}
pre code {
  background: transparent;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-md);
}
th, td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
}
th { font-weight: 600; }

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

/* ============================================================
   FORMS — buttons and inputs
   ============================================================ */
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  width: 100%;
  max-width: 24rem;
  transition: border-color 0.2s ease;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent);
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  margin-right: var(--space-xs);
}

label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-right: var(--space-md);
}

/* ============================================================
   COMPONENTS — site-specific
   ============================================================ */

/* --- Button --- */
.btn {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s ease;
}
.btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-warm-soft);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}
.btn--primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-bg);
}

/* --- Site Header --- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  max-width: var(--max-width);
  margin: 0 auto;
  border-bottom: 1px solid var(--color-border);
}

.site-logo {
  display: block;
  text-decoration: none;
  border: none;
  flex-shrink: 0;
}
.site-logo img,
.site-logo svg {
  height: 2.5rem;
  width: auto;
}
.site-logo {
  color: var(--color-text);
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-xl);
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: relative;
  padding-bottom: 0.15em;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}
.site-nav a:hover {
  color: var(--color-accent);
}
.site-nav a:hover::after {
  width: 100%;
}

.site-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: var(--text-xl);
  color: var(--color-text);
  cursor: pointer;
  padding: var(--space-xs);
}

@media (max-width: 640px) {
  .site-header {
    padding: var(--space-md);
    flex-wrap: wrap;
  }
  .site-logo img {
    height: 1.75rem;
  }
  .site-nav-toggle {
    display: block;
  }
  .site-nav {
    display: none;
    width: 100%;
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-md);
  }
  .site-nav.open {
    display: block;
  }
  .site-nav ul {
    flex-direction: column;
    gap: 0;
  }
  .site-nav a {
    display: block;
    padding: var(--space-sm) 0;
    font-size: var(--text-base);
  }
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: var(--space-3xl) var(--space-xl);
  max-width: var(--max-width);
  margin: 0 auto;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--color-overlay) 0%,
    transparent 60%
  );
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 36rem;
}
.hero-title {
  font-size: var(--text-hero);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: #f6f1eb;
  margin-bottom: var(--space-sm);
}
.hero-subtitle {
  font-size: var(--text-lg);
  font-weight: 400;
  color: rgba(246, 241, 235, 0.75);
  letter-spacing: 0.02em;
  margin: 0;
}

@media (max-width: 640px) {
  .hero {
    min-height: 50vh;
    padding: var(--space-2xl) var(--space-md);
  }
}

/* --- Section --- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-xl);
}
.section--narrow {
  max-width: var(--content-width);
}

.section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-sm);
}

@media (max-width: 640px) {
  .section {
    padding: var(--space-2xl) var(--space-md);
  }
}

/* --- Project Card --- */
.project-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease;
}
.project-card:hover {
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.project-card-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-surface);
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-md);
}
.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.project-card:hover .project-card-image img {
  transform: scale(1.03);
}
.project-card-body {
  padding: var(--space-xs) 0;
}
.project-card-title {
  font-size: var(--text-base);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}
.project-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* --- Project Grid --- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}
@media (max-width: 900px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .project-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}

/* --- Tag --- */
.tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  background: var(--color-surface);
  padding: 0.2em 0.6em;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
a.tag:hover,
button.tag:hover:not(:disabled),
.tag.active {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-warm-soft);
}
.tag:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* --- Tag Filter Bar --- */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

/* --- Site Footer --- */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl);
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.site-footer p {
  margin-bottom: var(--space-xs);
}
.site-footer a {
  color: var(--color-muted);
  text-decoration-color: var(--color-border);
}
.site-footer a:hover {
  color: var(--color-text);
}

/* --- Page Content (longform) --- */
.page-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl);
}
.page-content h1 {
  margin-bottom: var(--space-xl);
}
.page-content p {
  font-size: var(--text-lg);
  line-height: 1.8;
  margin-bottom: var(--space-lg);
}

@media (max-width: 640px) {
  .page-content {
    padding: var(--space-xl) var(--space-md);
  }
  .page-content p {
    font-size: var(--text-base);
  }
}

/* --- Home Sections --- */
.home-intro {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
}
.home-intro p {
  font-size: var(--text-xl);
  line-height: 1.8;
  margin: 0 auto var(--space-md);
  max-width: 32em;
}

.home-history {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
}
.home-history p {
  margin: 0 auto var(--space-lg);
}

/* --- Sticky Tag Filter Bar --- */
.tag-filter-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
}
.tag-filter-bar .tag-filter {
  margin-bottom: 0;
}

/* --- Masonry Image Grid --- */
.image-masonry {
  columns: 3;
  column-gap: var(--space-md);
  column-fill: auto;
  padding-top: var(--space-lg);
}
.image-masonry-item {
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin-bottom: var(--space-md);
  border-radius: var(--radius-md);
  clip-path: inset(0 round var(--radius-md));
  cursor: pointer;
  background: var(--color-surface);
}
.image-masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s ease;
}
.image-masonry-item:hover img {
  transform: scale(1.03);
}

@media (max-width: 900px) {
  .image-masonry { columns: 2; }
}
@media (max-width: 480px) {
  .image-masonry { columns: 1; }
}

/* --- Fullscreen Lightbox --- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
}
.lightbox.open {
  display: flex;
}
.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  user-select: none;
}
.lightbox-close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  background: none;
  border: none;
  color: #f6f1eb;
  font-size: var(--text-2xl);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  line-height: 1;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #f6f1eb;
  font-size: var(--text-3xl);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: var(--space-lg);
  line-height: 1;
}
.lightbox-nav:hover { opacity: 1; }
.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }
.lightbox-counter {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(246, 241, 235, 0.6);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}
