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

/* ── Variables ── */
:root {
  --bg:        #fffaf5;
  --ink:       #2a2018;
  --muted:     #9a8f83;
  --accent:    #d4622a;
  --line:      #e8e0d6;
  --main:      #3d3028;
  --sidebar-w: 220px;
}

[data-theme="dark"] {
  --bg:    #1c1814;
  --ink:   #f2ebe0;
  --muted: #7a6f65;
  --line:  #2e2820;
  --main:  #9c948e;
}

/* ── Base ── */
html { font-size: 16px; }

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  min-height: 100vh;
  display: flex;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 200;
  opacity: 0.5;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 2.5rem 2rem;
  background: var(--bg);
  z-index: 100;
}

.sidebar-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.sidebar-tagline {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3rem;
}

.nav-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

nav ul {
  list-style: none;
  margin-bottom: 3rem;
}

nav ul li { margin-bottom: 0.1rem; }

nav ul li a {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--ink);
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease;
  letter-spacing: 0.01em;
}

nav ul li a:hover,
nav ul li a.active {
  background: rgba(212, 98, 42, 0.08);
  color: var(--accent);
}

nav ul li a.active { font-weight: 400; }

.sidebar-divider {
  width: 100%;
  height: 1px;
  background: var(--line);
  margin-bottom: 2rem;
}

.sidebar-social {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
  letter-spacing: 0.02em;
}

.sidebar-social a:hover { color: var(--accent); }

.sidebar-social a svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.sidebar-footer {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ── Theme switch ── */
.theme-switch {
  margin-top: auto;
  margin-bottom: 0.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.switch-track {
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: var(--line);
  position: relative;
  transition: background 0.3s;
  flex-shrink: 0;
}

.theme-switch input:checked + .switch-track { background: var(--muted); }

.switch-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  top: 3px;
  left: 3px;
  transition: transform 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

.theme-switch input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
}

/* ── Main layout ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 5rem 4rem 4rem;
  position: relative;
  z-index: 1;
}

.content { max-width: 600px; }

/* ── Shared typography ── */
header {
  margin-bottom: 3.5rem;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.7s ease forwards;
}

.eyebrow {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(3rem, 7vw, 5rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

.divider {
  width: 2.5rem;
  height: 1px;
  background: var(--accent);
  margin-top: 1.8rem;
}

.section-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.7s ease 0.12s forwards;
}

/* ── Shared link row (pub/news arrows) ── */
.pub-arrow {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: transform 0.2s, color 0.2s;
  text-decoration: none;
}

.pub-arrow:hover {
  color: var(--accent);
  transform: translateX(4px);
}

/* ── Footer ── */
footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.48s forwards;
}

/* ── Corner photo ── */
.corner-photo {
  position: fixed;
  bottom: 0;
  right: 0;
  width: clamp(260px, 35vw, 520px);
  max-height: 50vh;
  pointer-events: none;
  z-index: 0;
}

.corner-photo img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 50vh;
  object-fit: contain;
  object-position: bottom right;
  opacity: 0.25;
  mix-blend-mode: multiply;
}

[data-theme="dark"] .corner-photo img {
  mix-blend-mode: screen;
  opacity: 0.12;
}

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 250, 245, 0.88);
  z-index: 500;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.4);
}

#lightbox-caption {
  display: none;
  margin-top: 1rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-align: center;
  max-width: 60ch;
}

.lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Animations ── */
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* ── Mobile ── */
@media (max-width: 720px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 1rem 0.75rem 1.5rem;
    flex-wrap: nowrap;
    gap: 0;
    overflow: hidden;
  }

  .sidebar-tagline,
  .nav-label,
  .sidebar-divider,
  .sidebar-footer,
  .sidebar-social { display: none; }

  .sidebar-logo {
    flex-shrink: 0;
    margin-right: 0.75rem;
  }

  nav {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  nav::-webkit-scrollbar { display: none; }

  nav ul {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0;
    flex-wrap: nowrap;
  }

  nav ul li a {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    white-space: nowrap;
  }

  .theme-switch {
    margin-top: 0;
    margin-left: auto;
    margin-bottom: 0;
    flex-shrink: 0;
    padding-left: 0.5rem;
  }

  body { flex-direction: column; }

  .main {
    margin-left: 0;
    padding: 2.5rem 1.5rem 3rem;
  }
}
