/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --sand: #EDE4CE;
  --sand-deep: #5D5039;
  --paper: #776749;
  --ink: #15130D;
  --ink-soft: rgba(21,19,13,0.6);
  --ink-faint: rgba(21,19,13,0.32);
  --cream-soft: rgba(237,228,206,0.6);
  --cream-faint: rgba(237,228,206,0.32);
  --welcome-bg: #0E0C08;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }

/* ============================================================
   Site nav (About / Portfolio / Contact pages)
   ============================================================ */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 32px;
}
.wordmark {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}
.nav-links {
  display: flex;
  gap: 22px;
}
.nav-links a {
  font-size: 11px;
  letter-spacing: 0.10em;
  color: var(--ink-soft);
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a.active { color: var(--ink); }

/* ============================================================
   Page shell (About / Portfolio / Contact)
   ============================================================ */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(34px, 5vw, 52px);
  color: var(--ink);
  padding: 8px 32px 40px;
}
.page-title a {
  color: inherit;
  text-decoration: none;
}
.page-title a:hover {
  color: var(--ink-soft);
}
.page-footer {
  margin-top: auto;
  padding: 24px 32px 30px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

/* ============================================================
   About page
   ============================================================ */
.about-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 48px;
  padding: 0 32px 60px;
  align-items: start;
}
.about-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--paper);
  border: 1px dashed var(--cream-faint);
  display: flex;
  align-items: center;
  justify-content: center;
}
.about-photo span {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--cream-faint);
}
.about-photo img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.about-text {
  max-width: 60ch;
  padding-top: 8px;
}
.about-text p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-soft);
  margin-bottom: 1.2em;
}
.about-text p:first-of-type {
  font-family: var(--font-serif);
  font-size: 21px;
  font-style: italic;
  line-height: 1.6;
  color: var(--ink);
}

@media (max-width: 820px) {
  .about-layout { grid-template-columns: 1fr; gap: 28px; }
  .about-photo { aspect-ratio: 16 / 10; }
}

/* ============================================================
   Portfolio page
   ============================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  padding: 0 32px 34px;
}
.filter-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 4px 0;
  position: relative;
}
.filter-btn::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
}
.filter-btn:hover { color: var(--ink); }
.filter-btn.active { color: var(--ink); }
.filter-btn.active::after { transform: scaleX(1); }

.gallery-grid {
  flex: 1;
  columns: 3;
  column-gap: 22px;
  padding: 0 32px 40px;
}
.gallery-item {
  display: block;
  width: 100%;
  break-inside: avoid;
  margin: 0 0 22px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--ink);
  cursor: pointer;
  background: var(--paper);
  padding: 0;
}
.gallery-item .placeholder {
  aspect-ratio: 4 / 5;
  width: 100%;
  border: 1px dashed var(--cream-faint);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.9s cubic-bezier(0.16,1,0.3,1);
}
.gallery-item .placeholder span {
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--cream-faint);
  padding: 0 10px;
  text-align: center;
}
.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.9s cubic-bezier(0.16,1,0.3,1);
}
.gallery-item:hover .placeholder,
.gallery-item:hover img { transform: scale(1.03); }
.gallery-item .cap {
  position: absolute; left: 12px; bottom: 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--sand);
  opacity: 0;
  transition: opacity 0.4s ease;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
.gallery-item:hover .cap { opacity: 1; }
.gallery-item.hidden { display: none; }

@media (max-width: 820px) {
  .gallery-grid { columns: 2; }
}
@media (max-width: 480px) {
  .gallery-grid { columns: 1; }
}

/* ============================================================
   Lightbox
   ============================================================ */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(14,12,8,0.97);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
}
.lightbox.open { display: flex; }
.lightbox-frame {
  position: relative;
  max-width: 1100px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-image-wrap {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--ink);
  background: var(--sand-deep);
  align-items: center; justify-content: center;
  overflow: hidden;
}
.lightbox-image-wrap span {
  font-size: 12px;
  letter-spacing: 0.05em;
  color: rgba(237,228,206,0.5);
  padding: 90px 60px;
}
.lightbox-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  width: auto;
  height: auto;
}
.lightbox-caption {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-top: 18px;
}
.lightbox-caption .name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 19px;
  color: var(--sand);
}
.lightbox-caption .count {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(237,228,206,0.45);
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(237,228,206,0.7);
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.06em;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { color: var(--sand); }
.lightbox-close { top: 24px; right: 28px; font-size: 22px; }
.lightbox-prev { left: -4px; top: 50%; transform: translateY(-50%); font-size: 26px; }
.lightbox-next { right: -4px; top: 50%; transform: translateY(-50%); font-size: 26px; }

@media (max-width: 700px) {
  .lightbox { padding: 90px 16px 40px; }
  .lightbox-prev { left: 0; }
  .lightbox-next { right: 0; }
}

/* ============================================================
   Contact page
   ============================================================ */
.contact-layout {
  flex: 1;
  padding: 0 32px 60px;
  max-width: 520px;
}
.contact-intro {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 34px;
  max-width: 46ch;
}
.field {
  margin-bottom: 22px;
}
.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.field input,
.field textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink-faint);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  padding: 8px 2px;
  outline: none;
  transition: border-color 0.3s ease;
}
.field input:focus,
.field textarea:focus { border-color: var(--ink); }
.field textarea { resize: vertical; min-height: 110px; }
.submit-btn {
  margin-top: 8px;
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 12px 28px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}
.submit-btn:hover { background: var(--ink); color: var(--sand); }
.submit-btn:disabled { opacity: 0.5; cursor: default; }
.form-status {
  margin-top: 16px;
  font-size: 13px;
  min-height: 18px;
}
.form-status.success { color: #3F5B2B; }
.form-status.error { color: #7A2E22; }

/* ============================================================
   Utility
   ============================================================ */
.on-dark-page { background: var(--welcome-bg); }
.no-scroll { overflow: hidden; }
.page-enter { opacity: 0; transition: opacity 1.1s ease; }
.page-enter-active { opacity: 1; }

/* ============================================================
   Portfolio landing — vertical category list
   ============================================================ */
.category-list {
  list-style: none;
  flex: 1;
  padding: 0 32px;
}
.category-row {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--ink-faint);
  text-decoration: none;
  color: inherit;
}
.category-list li:last-child .category-row { border-bottom: none; }
.category-row .thumb {
  position: relative;
  width: 76px; height: 76px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px dashed var(--cream-faint);
  display: flex; align-items: center; justify-content: center;
}
.category-row .thumb span {
  font-size: 8px;
  letter-spacing: 0.03em;
  color: var(--cream-faint);
  text-align: center;
  line-height: 1.3;
  padding: 0 4px;
}
.category-row .thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.category-row .cat-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(22px, 3.4vw, 30px);
  color: var(--ink);
  transition: color 0.3s ease, transform 0.3s ease;
}
.category-row:hover .cat-name { color: var(--ink-soft); transform: translateX(6px); }

/* ============================================================
   Welcome screen (index.html)
   ============================================================ */
#welcome {
  position: fixed; inset: 0;
  background: var(--welcome-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 3;
  cursor: pointer;
  transition: opacity 1.4s ease;
}
#welcome.fade-out { opacity: 0; }
#welcome h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(48px, 11vw, 108px);
  letter-spacing: 0.01em;
  color: var(--sand);
}
#welcome .rule {
  width: 44px; height: 1px; background: var(--sand); margin: 22px 0 18px;
}
#welcome .enter {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(237,228,206,0.55);
}

/* ============================================================
   Home page portals
   ============================================================ */
#home {
  position: fixed; inset: 0;
  z-index: 1;
  background: var(--sand);
}
.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 32px;
  z-index: 4;
  pointer-events: none;
}
.topbar .wordmark { pointer-events: auto; }
.topbar .nav-links { pointer-events: auto; }
.home-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  height: 100%;
}
.col-right {
  display: grid;
  grid-template-rows: 1fr 1fr;
}
.portal {
  position: relative;
  overflow: hidden;
  border: none;
  background: none;
  cursor: pointer;
  display: block;
  width: 100%; height: 100%;
  text-align: left;
}
.portal .placeholder {
  position: absolute; inset: 0;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  transition: transform 1.1s cubic-bezier(0.16,1,0.3,1);
  border: 1px dashed var(--cream-faint);
}
.portal .placeholder img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.portal .placeholder span {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--cream-faint);
}
.portal:hover .placeholder { transform: scale(1.035); }
.portal-portfolio { border-right: 1px solid var(--ink); }
.col-right .portal-about { border-bottom: 1px solid var(--ink); }
.portal .label {
  position: absolute;
  left: 20px; bottom: 18px;
  display: flex; align-items: baseline; gap: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  z-index: 2;
}
.portal:hover .label { opacity: 1; transform: translateY(0); }
.portal .label .num { font-size: 11px; color: var(--cream-soft); }
.portal .label .name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 20px;
  color: var(--sand);
}

@media (max-width: 768px) {
  .home-grid { grid-template-columns: 1fr; grid-template-rows: 1.3fr 1fr; }
  .portal-portfolio { border-right: none; border-bottom: 1px solid var(--ink); }
  .col-right { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
  .col-right .portal-about { border-bottom: none; border-right: 1px solid var(--ink); }
  #welcome h1 { font-size: clamp(40px, 15vw, 72px); }
}
