/* ---------- Design tokens ---------- */
:root {
  --bg: #16181d;
  --surface: #1f2229;
  --text: #e9e7e2;
  --muted: #9a9ea9;
  --accent: #d2b98c;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gap: 12px;
  --page-pad: clamp(16px, 4vw, 48px);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 16px var(--page-pad);
  background: rgba(22, 24, 29, 0.92);
  backdrop-filter: blur(8px);
}

.site-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: 24px;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

/* ---------- Social links ----------
   A row of icons above the gallery. Icons use the text colour
   and turn gold on hover. */
.social {
  padding: 8px var(--page-pad) 20px;
}

.icon-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.icon-list a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--muted);
  transition: color 0.2s ease;
}

.icon-list a:hover {
  color: var(--accent);
}

.icon-list svg,
.icon-list img {
  width: 24px;
  height: 24px;
}

/* Image icons (Royal Road) keep their own colours, so they are shown
   in grey to match the other icons, and in full colour on hover. */
.icon-list img {
  filter: grayscale(1);
  opacity: 0.7;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.icon-list a:hover img {
  filter: none;
  opacity: 1;
}

/* ---------- Gallery ----------
   Columns place images top to bottom, then start the next column.
   Images keep their own proportions, so nothing is cropped. */
#gallery {
  padding: var(--gap) var(--page-pad) 64px;
}

.grid {
  column-count: 3;
  column-gap: var(--gap);
}

.piece {
  display: block;
  margin: 0 0 var(--gap);
  break-inside: avoid;
  background: var(--surface);
  cursor: zoom-in;
}

.piece img {
  display: block;
  width: 100%;
  height: auto;
  transition: opacity 0.2s ease;
}

.piece:hover img {
  opacity: 0.85;
}

@media (max-width: 900px) {
  .grid { column-count: 2; }
}

@media (max-width: 560px) {
  .grid { column-count: 1; }
  .site-header { flex-direction: column; gap: 4px; }
  .icon-list { gap: 0; }
}

/* ---------- Text sections ---------- */
.text-section {
  max-width: 62ch;
  margin: 0 auto;
  padding: 48px var(--page-pad);
}

.text-section h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
}

.text-section p {
  margin: 0;
  color: var(--muted);
}


/* ---------- Footer ---------- */
.site-footer {
  padding: 32px var(--page-pad) 48px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.site-footer p { margin: 0; }

/* ---------- Lightbox ---------- */
#lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10, 11, 14, 0.96);
  color: var(--text);
}

#lightbox[open] {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
}

#lightbox::backdrop {
  background: rgba(10, 11, 14, 0.96);
}

#lightbox figure {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100vh;
  margin: 0;
  padding: 24px 0;
  min-width: 0;
}

#lb-image {
  max-width: 100%;
  max-height: calc(100vh - 96px);
  object-fit: contain;
}

#lb-caption {
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.lb-btn {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 16px;
}

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

.lb-prev { grid-column: 1; grid-row: 1; }
.lb-next { grid-column: 3; grid-row: 1; }

.lb-close {
  position: absolute;
  top: 8px;
  right: 8px;
}

@media (max-width: 560px) {
  #lightbox[open] { grid-template-columns: 40px 1fr 40px; }
  .lb-btn { padding: 8px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .piece img { transition: none; }
  .icon-list a { transition: none; }
}
