:root {
  --canvas: #f1ecdf;
  --paper: #fffdf7;
  --ink: #17140f;
  --muted: #6c6559;
  --rule: #c9c0af;
  --accent: #98452f;
  --accent-dark: #713220;
  --focus: #1b63a3;
  --shadow: 0 2px 0 rgba(23, 20, 15, 0.9);
  --page-width: 1180px;
  --control-size: 46px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  line-height: 1.55;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.62), transparent 26rem),
    var(--canvas);
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.65rem 0.85rem;
  color: var(--paper);
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  width: min(calc(100% - 2rem), var(--page-width));
  margin: 0 auto;
  padding: 0 0 1.5rem;
  text-align: center;
}

.brand {
  display: inline-block;
  margin-top: 1.7rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-kicker {
  display: block;
  margin-bottom: -0.35rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.75rem, 1.4vw, 0.9rem);
  font-style: italic;
  letter-spacing: 0.16em;
  text-transform: lowercase;
}

.brand-title {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.brand-title::after {
  content: "";
  display: block;
  width: 41%;
  height: 0.18rem;
  margin: 0.45rem auto 0;
  background: var(--accent);
  transform: rotate(-1deg);
}

.tagline {
  margin: 0.9rem auto 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  font-style: italic;
}

.site-links {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  margin-top: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  min-height: 48px;
  margin-top: 0;
  border-bottom: 1px solid var(--rule);
}

.header-actions .site-links {
  margin-top: 0;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.language-switch a,
.language-switch span[aria-current="page"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 44px;
}

.language-switch span[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.site-links a[aria-current="page"] {
  color: var(--ink);
  text-decoration-thickness: 2px;
}

.page-shell {
  width: min(calc(100% - 2rem), var(--page-width));
  margin: 0 auto;
}

.comic-page {
  padding-bottom: 3rem;
}

.comic-heading {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.7rem;
  margin: 0 0 1.1rem;
  text-align: center;
}

.comic-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.2;
}

.issue-number {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-style: italic;
}

.comic-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 auto 0.7rem;
}

.comic-nav + .comic-heading {
  margin-top: 0;
}

.comic-nav.bottom {
  margin: 1.35rem auto 0;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-size);
  height: var(--control-size);
  flex: 0 0 var(--control-size);
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.material-symbols-outlined {
  display: block;
  font-size: 1.45rem;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
  line-height: 1;
}

.nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-button:hover {
  color: var(--paper);
  background: var(--ink);
}

.nav-button:active {
  box-shadow: none;
  transform: translateY(2px);
}

.nav-button[aria-disabled="true"] {
  color: #8d877c;
  border-color: #aaa296;
  background: #e8e2d6;
  box-shadow: none;
  cursor: not-allowed;
}

.comic-frame {
  margin: 0;
  padding: clamp(0.45rem, 1.4vw, 0.9rem);
  border: 1px solid var(--rule);
  background: var(--paper);
  box-shadow: 0 0.7rem 2rem rgba(60, 47, 28, 0.09);
}

.comic-frame img {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
}

.comic-zoom {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 44px;
  margin: 0.75rem auto 0;
  padding: 0.5rem 0.9rem;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.philosophy-note {
  max-width: 52rem;
  margin: 1.35rem auto 0;
  padding: clamp(1rem, 2.8vw, 1.5rem);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 72%, transparent);
}

.philosophy-note h2 {
  margin: 0 0 0.8rem;
  color: var(--accent-dark);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.philosophy-note blockquote {
  margin: 0 auto 1rem;
  padding: 0;
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
}

.philosophy-note blockquote p {
  margin: 0;
  font-size: clamp(1.1rem, 2.7vw, 1.35rem);
  font-style: italic;
  line-height: 1.4;
}

.philosophy-note blockquote footer {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.philosophy-note > p {
  max-width: 68ch;
  margin: 0.75rem auto 0;
  font-size: 0.96rem;
  line-height: 1.62;
}

.philosophy-author {
  color: var(--muted);
}

.philosophy-history {
  padding-top: 0.75rem;
  border-top: 1px dashed var(--rule);
}

.philosophy-history a {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.philosophy-note .philosophy-source {
  color: var(--muted);
  font-size: 0.78rem;
}

.philosophy-source a {
  color: var(--accent-dark);
  font-weight: 700;
  text-underline-offset: 0.18em;
}

.comic-date {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.content-page {
  max-width: 760px;
  margin: 0 auto 4rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--rule);
  background: var(--paper);
}

.characters-page {
  max-width: 980px;
}

.characters-intro {
  max-width: 62ch;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  font-style: italic;
}

.cast-portrait {
  margin: 0 0 2rem;
  padding: 0.55rem;
  border: 1px solid var(--rule);
  background: #fff;
}

.cast-portrait img {
  display: block;
  width: 100%;
  height: auto;
}

.cast-section + .cast-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.cast-section h2 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.cast-section-lede {
  margin-top: 0;
  color: var(--muted);
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 1.25rem;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.character-card {
  position: relative;
  min-height: 12rem;
  padding: clamp(1.1rem, 3vw, 1.6rem);
  background: var(--paper);
}

.character-card::before {
  content: attr(data-mark);
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  color: color-mix(in srgb, var(--accent) 18%, transparent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 4.5rem;
  font-style: italic;
  line-height: 1;
}

.character-card h3 {
  position: relative;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
}

.character-role {
  position: relative;
  margin: 0.15rem 0 0.75rem;
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.character-card p:last-child {
  position: relative;
  margin-bottom: 0;
}

.content-page h1,
.content-page h2 {
  font-family: Georgia, "Times New Roman", serif;
}

.content-page h1 {
  margin-top: 0;
  font-size: clamp(2rem, 5vw, 3.1rem);
}

.content-page p,
.content-page li {
  max-width: 68ch;
}

.archive-list {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.archive-list li {
  border-bottom: 1px solid var(--rule);
}

.archive-list a {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  min-height: 52px;
  padding: 0.8rem 0.25rem;
  color: var(--ink);
  text-decoration: none;
}

.archive-list a:hover {
  color: var(--accent-dark);
  background: #f8f3e8;
}

.archive-number,
.archive-date {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-footer {
  width: min(calc(100% - 2rem), var(--page-width));
  margin: 0 auto;
  padding: 1.4rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.82rem;
  text-align: center;
}

.keyboard-hint {
  margin-top: 0.25rem;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media (max-width: 680px) {
  .site-header {
    padding-top: 0;
  }

  .brand {
    margin-top: 1.35rem;
  }

  .site-links {
    gap: 0.9rem;
  }

  .header-actions {
    justify-content: center;
    gap: 0.45rem;
  }

  .comic-heading {
    flex-direction: column;
    gap: 0.1rem;
  }

  .character-grid {
    grid-template-columns: 1fr;
  }

  .comic-nav {
    gap: clamp(0.4rem, 2.6vw, 0.75rem);
  }

  .comic-zoom {
    display: flex;
  }

  .comic-frame.is-zoomed {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .comic-frame.is-zoomed img {
    width: 880px;
    max-width: none;
    scroll-snap-align: start;
  }

  .archive-list a {
    grid-template-columns: 2.4rem 1fr;
  }

  .archive-date {
    display: none;
  }

  .keyboard-hint {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.35rem 0;
    text-align: left;
  }

  .brand-kicker,
  .tagline {
    display: none;
  }

  .brand-title {
    font-size: 1.4rem;
    letter-spacing: -0.035em;
    line-height: 1;
  }

  .brand-title::after {
    width: 100%;
    height: 0.1rem;
    margin-top: 0.2rem;
  }

  .brand {
    margin-top: 0;
  }

  .site-links {
    gap: 0.85rem;
    margin-top: 0;
    font-size: 0.72rem;
  }

  .header-actions {
    gap: 0.35rem;
    min-height: 44px;
    margin-top: 0;
    border-bottom: 0;
  }

  .language-switch a,
  .language-switch span[aria-current="page"] {
    min-width: 32px;
    min-height: 44px;
  }

  .page-shell {
    width: min(calc(100% - 1rem), var(--page-width));
  }

  .comic-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.75rem;
    padding-bottom: 0.5rem;
  }

  .comic-heading {
    min-width: 0;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.45rem;
    margin: 0;
    text-align: left;
  }

  .comic-heading h1 {
    overflow: hidden;
    font-size: clamp(1rem, 3.6vw, 1.35rem);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .issue-number {
    font-size: 0.75rem;
  }

  .comic-nav:not(.bottom) {
    position: sticky;
    z-index: 10;
    top: 0.25rem;
    width: max-content;
    justify-self: end;
    justify-content: flex-start;
    gap: 0.35rem;
    margin: 0;
    padding: 0.25rem;
    border: 1px solid var(--rule);
    border-radius: 2rem;
    background: color-mix(in srgb, var(--canvas) 92%, transparent);
    backdrop-filter: blur(8px);
  }

  .nav-button {
    --control-size: 44px;
    border-radius: 50%;
  }

  .comic-frame {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.3rem;
  }

  .comic-frame img {
    max-height: calc(100dvh - 102px);
    object-fit: contain;
  }

  .comic-zoom {
    display: none;
  }

  .philosophy-note,
  .comic-date,
  .comic-nav.bottom,
  .site-footer {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
