:root {
  --bg: #121212;
  --fg: #ece8e1;
  --muted: #9b968d;
  --line: #2c2b29;
  --accent: #e8c27a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration-color: var(--muted); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: #000; padding: 8px 12px; z-index: 10;
}
.skip:focus { left: 8px; }

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 28px var(--gutter) 20px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.brand { text-decoration: none; display: block; }
.brand:hover { color: inherit; }
.brand .name {
  display: block;
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.brand .role {
  display: block;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}
.nav { display: flex; gap: 28px; font-family: var(--sans); font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; }
.nav a { text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent; }
.nav a:hover { border-bottom-color: var(--accent); }
.nav a[aria-current="page"] { border-bottom-color: var(--fg); }

main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter) 48px; }

/* Carousel */
.carousel { position: relative; width: min(100%, calc((100vh - 240px) * 1.5)); min-width: min(100%, 560px); margin: 0 auto; }
.viewport {
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: #1a1a1a;
  touch-action: pan-y;
  outline-offset: 4px;
}
.track { display: flex; height: 100%; transition: transform 0.55s cubic-bezier(.22,.7,.2,1); will-change: transform; }
.slide { flex: 0 0 100%; height: 100%; margin: 0; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }

.arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.45);
  color: #fff; cursor: pointer;
  display: grid; place-items: center;
  backdrop-filter: blur(4px);
  transition: background .2s, border-color .2s;
}
.arrow:hover { background: rgba(0,0,0,.75); border-color: var(--accent); }
.arrow svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.arrow.prev { left: 14px; }
.arrow.next { right: 14px; }

.controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; font-family: var(--sans); }
.dots { display: flex; flex-wrap: wrap; gap: 4px; }
.dot {
  width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--line); border: 1px solid var(--muted); transition: background .2s, transform .2s; }
.dot[aria-current="true"]::after { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.counter { font-size: 0.8rem; letter-spacing: 0.14em; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Text pages */
.prose { max-width: 40rem; margin: 12px auto 0; font-size: 1.12rem; }
.prose h1 { font-size: clamp(1.9rem, 4vw, 2.4rem); font-weight: 400; margin: 8px 0 28px; line-height: 1.2; }
.prose p { margin: 0 0 1.25em; }
.prose .proverb { font-style: italic; font-size: 1.25rem; color: var(--accent); }
.prose .contact { margin-top: 2em; padding-top: 1.25em; border-top: 1px solid var(--line); font-family: var(--sans); font-size: 0.98rem; line-height: 1.9; }

.portrait { margin: 0 0 36px; }
.portrait img { width: 100%; height: auto; display: block; }
.portrait figcaption { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); margin-top: 8px; letter-spacing: 0.04em; }

/* Newsletter form */
.signup { margin-top: 32px; padding: 28px; border: 1px solid var(--line); background: #181817; font-family: var(--sans); }
.signup h2 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; margin: 0 0 4px; }
.signup .req { color: var(--muted); font-size: 0.8rem; margin: 0 0 20px; }
.signup label { display: block; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.signup input[type="email"], .signup input[type="text"] {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 1rem; color: var(--fg);
  background: #0e0e0e; border: 1px solid #3a3936; border-radius: 2px;
}
.signup input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(232,194,122,.3); }
.signup button {
  margin-top: 24px; padding: 13px 28px; font: inherit; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase;
  background: var(--accent); color: #111; border: 0; border-radius: 2px; cursor: pointer; font-weight: 600;
}
.signup button:hover { background: #f1d08f; }
.hp { position: absolute; left: -5000px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px var(--gutter);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px;
  font-family: var(--sans); font-size: 0.8rem; color: var(--muted);
  max-width: 1280px; width: 100%; margin: 0 auto;
}
.social { display: flex; gap: 22px; }
.social a { text-decoration: none; letter-spacing: 0.1em; text-transform: uppercase; }

@media (max-width: 560px) {
  .site-header { padding-top: 20px; }
  .nav { gap: 20px; }
  .arrow { width: 42px; height: 42px; }
  .arrow.prev { left: 8px; } .arrow.next { right: 8px; }
  .viewport { aspect-ratio: 4 / 3; }
  .signup { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .track { transition: none; }
}

/* ===== Home page: fullscreen photo background ===== */
html:has(body.home), body.home { height: 100%; overflow: hidden; }
body.home { background: #1a1a1a; display: block; }
.home main { position: static; max-width: none; padding: 0; margin: 0; }

.home .carousel { position: fixed; inset: 0; width: auto; min-width: 0; margin: 0; z-index: 0; }
.home .viewport { height: 100%; aspect-ratio: auto; background: #1a1a1a; }
.home .viewport:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.home .slide img { object-position: center; }

.home .site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  max-width: none; margin: 0; width: auto;
  padding: 24px var(--gutter) 56px;
  color: #fff;
  background: linear-gradient(to bottom, rgba(0,0,0,.65), rgba(0,0,0,0));
  text-shadow: 0 1px 12px rgba(0,0,0,.55);
  pointer-events: none;
}
.home .site-header a { pointer-events: auto; }
.home .brand .role { color: rgba(255,255,255,.85); }
.home .nav a:hover { color: #fff; border-bottom-color: #fff; }

.home .controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; margin: 0;
  padding: 56px var(--gutter) 20px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,0));
  color: #fff;
}
.home .counter { justify-self: end; color: rgba(255,255,255,.85); text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.home .dot::after { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.8); }
.home .dot[aria-current="true"]::after { background: var(--accent); border-color: var(--accent); }

.home .icons { display: flex; gap: 6px; justify-self: start; }
.home .icon {
  width: 44px; height: 44px; display: grid; place-items: center; color: #fff; border-radius: 50%;
  transition: background .2s, color .2s;
}
.home .icon:hover { background: rgba(0,0,0,.45); color: var(--accent); }
.home .icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 6px rgba(0,0,0,.55)); }
.home .icon .dot-fill { fill: currentColor; stroke: none; }

@media (max-width: 560px) {
  .home .viewport { aspect-ratio: auto; }
  .home .site-header { padding-top: 18px; }
  .home .controls { grid-template-columns: auto 1fr auto; padding-bottom: 14px; }
  .home .dots { justify-self: center; gap: 0; }
  .home .dot { width: 17px; }
  .home .dots { flex-wrap: nowrap; }
  .home .counter { display: none; }
}

/* Crop anchors: keep the top of the photo in view */
.home .slide img.pos-top { object-position: center top; }

/* Substack embed */
.embed { margin-top: 32px; max-width: 480px; }
.embed iframe { display: block; width: 100%; max-width: 480px; height: 320px; border: 1px solid #eee; background: #fff; border-radius: 2px; }
.embed-alt { margin-top: 16px; font-family: var(--sans); font-size: 0.9rem; color: var(--muted); }
