:root,
html[data-theme="dark"] {
  --paper: #0b0d12;
  --paper-2: #141821;
  --ink: #e8e2d4;
  --muted: #8b8578;
  --line: #2a2e38;
  --accent: #d4b56a;
  --accent-ink: #14120c;
  --danger: #d07a6a;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  --glow: radial-gradient(ellipse 70% 45% at 92% -8%, rgba(186, 204, 230, 0.09), transparent 55%),
    radial-gradient(ellipse 45% 35% at 0% 100%, rgba(212, 181, 106, 0.05), transparent 50%);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --max: 68rem;
  color-scheme: dark;
}

html[data-theme="light"] {
  --paper: #efe6d2;
  --paper-2: #e4d9c0;
  --ink: #1c1914;
  --muted: #6a6256;
  --line: #d0c4a8;
  --accent: #8a5a16;
  --accent-ink: #fff8ea;
  --danger: #8c2f1c;
  --shadow: 0 18px 50px rgba(40, 28, 16, 0.14);
  --glow: radial-gradient(ellipse 60% 40% at 100% 0%, rgba(255, 244, 214, 0.7), transparent 55%);
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}

body {
  position: relative;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.18;
  mix-blend-mode: screen;
  will-change: transform;
}

.orb-a {
  width: 26rem;
  height: 26rem;
  left: -8%;
  top: 8%;
  background: #c9b27a;
  animation: orb-a 42s ease-in-out infinite;
}
.orb-b {
  width: 22rem;
  height: 22rem;
  right: -6%;
  top: 28%;
  background: #7f9bb8;
  animation: orb-b 54s ease-in-out infinite;
}
.orb-c {
  width: 18rem;
  height: 18rem;
  left: 28%;
  bottom: -10%;
  background: #8e6b8a;
  animation: orb-c 38s ease-in-out infinite;
}
.orb-d {
  width: 14rem;
  height: 14rem;
  right: 22%;
  bottom: 18%;
  background: #6f8f7a;
  animation: orb-d 48s ease-in-out infinite;
}

html[data-theme="light"] .orb {
  opacity: 0.11;
  mix-blend-mode: multiply;
  filter: blur(72px);
}
html[data-theme="light"] .orb-a { background: #d4b896; }
html[data-theme="light"] .orb-b { background: #b7c4ce; }
html[data-theme="light"] .orb-c { background: #cbb6b0; }
html[data-theme="light"] .orb-d { background: #b8c4b0; }

@keyframes orb-a {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(12%, 18%, 0); }
}
@keyframes orb-b {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-16%, 10%, 0); }
}
@keyframes orb-c {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(10%, -22%, 0); }
}
@keyframes orb-d {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-14%, -12%, 0); }
}

body > *:not(.sky) {
  position: relative;
  z-index: 1;
}

body.locked {
  overflow: hidden;
  height: 100vh;
}

.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.human {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.4rem 0 1rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  color: var(--ink);
}
.human input {
  width: auto;
  margin: 0;
  min-height: 18px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.7rem;
  z-index: 20;
}

.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.4rem 1.5rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}

.wordmark span {
  font-style: normal;
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.nav a,
.text-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.nav a:hover,
.nav a.is-on,
.text-btn:hover,
.icon-btn:hover {
  color: var(--ink);
}

.icon-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }

.nav a:focus-visible,
.text-btn:focus-visible,
.icon-btn:focus-visible,
.btn:focus-visible,
.tab:focus-visible,
input:focus-visible,
textarea:focus-visible,
.icon-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.4rem 1.5rem 6rem;
}

.kicker {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 1.4rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.prose { max-width: 38rem; }

.prose p {
  margin: 0 0 1.05rem;
  font-size: 1.05rem;
}

.journal { position: relative; }

.journal.locked {
  max-height: calc(100vh - 5.5rem);
  overflow: hidden;
}

.journal.locked .entry {
  filter: blur(16px);
  user-select: none;
  pointer-events: none;
}

.entry {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 38rem);
  column-gap: 1.5rem;
  padding: 0 0 2.6rem;
  margin: 0 0 2.4rem;
  border-bottom: 1px solid var(--line);
}

.entry:last-of-type { border-bottom: 0; }

.when {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.entry h2 {
  margin: 0 0 0.8rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  line-height: 1.15;
}

.entry .body p { margin: 0 0 0.95rem; }

.gate {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 5rem 1.5rem 2.2rem;
  background: linear-gradient(to bottom, transparent 0%, var(--paper) 42%);
  display: flex;
  justify-content: center;
}

.gate-card {
  width: min(28rem, 100%);
  background: var(--paper-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.35rem 1.3rem;
}

.gate-card h2 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 400;
}

.gate-card p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.btn {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 1.05rem;
  cursor: pointer;
  min-height: 44px;
}

.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.62);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 30;
}

html[data-theme="light"] .modal {
  background: rgba(26, 22, 18, 0.38);
}

.modal-card {
  position: relative;
  width: min(26rem, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1.6rem 1.4rem 1.4rem;
  box-shadow: var(--shadow);
}

.icon-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  border: 0;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  margin: 1rem 0;
}

.tab {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.45rem 0.2rem;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

.tab.is-on {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

label {
  display: block;
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 0.65rem 0.7rem;
}

textarea { min-height: 16rem; resize: vertical; }

.hint { margin: -0.4rem 0 0.8rem; font-size: 0.85rem; color: var(--muted); }
.form-error { color: var(--danger); margin: 0 0 0.8rem; }
.lede { color: var(--muted); margin: 0.2rem 0 0; }

.admin h1 { font-size: 2rem; }
.admin form {
  max-width: 40rem;
  margin-bottom: 2.5rem;
}
.admin-list { max-width: 40rem; }
.admin-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}
.admin-item button {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
  min-height: 44px;
}

.denied { max-width: 34rem; }
.flash {
  padding: 0.7rem 0.8rem;
  background: var(--paper-2);
  margin: 0 0 1rem;
}
.empty { color: var(--muted); }

.figures {
  display: grid;
  gap: 0.7rem;
  margin: 0 0 1.1rem;
}
.figures img,
.thumb img {
  display: block;
  width: 100%;
  max-height: 28rem;
  object-fit: cover;
  border: 1px solid var(--line);
}
.comments {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}
.comments h3 {
  margin: 0 0 0.8rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.25rem;
}
.comment {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.comment-meta {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.comment-form textarea { min-height: 6rem; }
.pager {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.6rem;
  margin: 0 0 1rem;
  max-width: 40rem;
}
.danger-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.4rem;
  margin: 2rem 0 0.5rem;
}
.thumb { display: grid; gap: 0.2rem; }
.thumb img { max-height: 7rem; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0 0 1.2rem;
  max-width: 40rem;
}
.stat {
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
}
.stat strong {
  display: block;
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 400;
}
.stat span { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.ip-list {
  display: grid;
  gap: 0.35rem;
  max-width: 40rem;
  margin: 0 0 1rem;
}
.ip-link {
  background: none;
  border: 0;
  padding: 0.45rem 0;
  text-align: left;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  min-height: 44px;
}
.ip-link:hover,
.ip-link.is-on {
  color: var(--ink);
}
.visit-detail {
  margin-top: 1rem;
  max-width: 40rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.visit-detail p { margin: 0 0 0.45rem; }
.visit-detail .ua { color: var(--muted); font-size: 0.85rem; word-break: break-all; }
@media (max-width: 720px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .entry {
    grid-template-columns: 1fr;
    row-gap: 0.35rem;
  }
  .mast { padding-inline: 1.1rem; }
  #main { padding-inline: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
