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

:root {
  --bg: #0f0f0f;
  --surface: #1c1c1c;
  --text: #e8e4df;
  --text-muted: #8a8480;
  --accent: #c8a96a;
  --gap: 8px;
  --radius: 3px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Header ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid #1f1f1f;
}

.site-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: 2rem;
}

.site-nav a {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.2s;
}

.site-nav a:hover { color: var(--text); }

/* ── Intro ── */
.intro {
  padding: 1.5rem 2rem 0.5rem;
}

.intro p {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ── Gallery ── */
.gallery {
  columns: 3 240px;
  column-gap: var(--gap);
  padding: 1.25rem 2rem 2rem;
}

.gallery-item {
  break-inside: avoid;
  display: block;
  width: 100%;
  margin-bottom: var(--gap);
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.25) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--radius);
}

.gallery-item:hover .item-overlay { opacity: 1; }
.gallery-item:hover img { transform: scale(1.03); }

.item-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  text-align: left;
}

.item-tags {
  display: block;
  font-size: 0.72rem;
  color: var(--accent);
  margin-top: 0.3rem;
  letter-spacing: 0.04em;
  text-align: left;
}

/* ── Dialog / Lightbox ── */
dialog {
  background: var(--surface);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 0;
  max-width: min(740px, 95vw);
  width: 100%;
  max-height: 92vh;
  overflow: hidden;
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.75rem 0;
  flex-shrink: 0;
}

.dialog-close {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}

.dialog-close:hover {
  background: rgba(255,255,255,0.15);
  color: var(--text);
}

.dialog-nav {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}

.dialog-nav:hover:not(:disabled) {
  background: rgba(255,255,255,0.15);
  color: var(--text);
}

.dialog-nav:disabled {
  opacity: 0.2;
  cursor: default;
}

.dialog-scroll {
  overflow-y: auto;
  padding: 0.5rem 1.5rem 1.75rem;
}

.dialog-main-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.dialog-meta h2 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.dialog-tags {
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.dialog-text p {
  font-size: 0.9rem;
  line-height: 1.75;
  color: #aaa;
  margin-bottom: 0.75rem;
}

.dialog-extra-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  margin-top: 1rem;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-top: 1px solid #1f1f1f;
}

/* ── About page ── */
.about-wrap {
  max-width: 620px;
  margin: 4rem auto;
  padding: 0 2rem;
}

.about-wrap h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.about-portrait {
  width: 100%;
  max-width: 380px;
  height: auto;
  display: block;
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

.about-wrap p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #aaa;
  margin-bottom: 1rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .site-header { padding: 1rem 1.25rem; }
  .gallery { columns: 2; padding: 1rem 1rem 2rem; }
  .intro { padding: 1rem 1.25rem 0.25rem; }
  .about-wrap { margin: 2rem auto; }
  dialog { max-height: 95vh; border-radius: 6px; }
}

@media (max-width: 400px) {
  .gallery { columns: 1; }
}
