@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Lora:ital,wght@0,400;0,500;0,600;1,400&display=swap");

:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --nav-bg: rgba(246, 243, 237, 0.86);
  --surface: rgba(255, 255, 255, 0.72);
  --text: #172033;
  --muted: #667085;
  --line: rgba(23, 32, 51, 0.11);
  --hover: rgba(23, 32, 51, 0.06);
  --active: rgba(23, 32, 51, 0.12);
  --control-bg: rgba(255, 255, 255, 0.9);
  --control-text: #172033;
  --shadow: 0 22px 46px -20px rgba(23, 32, 51, 0.42);
  --reader-size: 20px;
  --accent: #8a6d3b;
  --accent-soft: rgba(138, 109, 59, 0.28);
}

html[data-theme="sepia"] {
  --bg: #fbf8f1;
  --nav-bg: rgba(251, 248, 241, 0.86);
  --surface: rgba(255, 255, 255, 0.66);
  --text: #4a3f35;
  --muted: rgba(74, 63, 53, 0.64);
  --line: rgba(74, 63, 53, 0.1);
  --hover: rgba(226, 214, 195, 0.55);
  --active: #e9dcc7;
  --control-bg: rgba(255, 255, 255, 0.9);
  --control-text: #172033;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #020617;
  --nav-bg: rgba(2, 6, 23, 0.82);
  --surface: rgba(15, 23, 42, 0.74);
  --text: #e2e8f0;
  --muted: rgba(226, 232, 240, 0.6);
  --line: rgba(255, 255, 255, 0.08);
  --hover: rgba(51, 65, 85, 0.5);
  --active: #334155;
  --control-bg: rgba(30, 41, 59, 0.9);
  --control-text: #e2e8f0;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Lora", ui-serif, Georgia, serif;
  transition: background-color 500ms ease, color 500ms ease;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.v2-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 0;
  height: 4px;
  background: var(--accent);
  transition: width 150ms ease;
}

.v2-shell {
  min-height: 100vh;
}

.v2-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
}

.v2-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1280px);
  height: 64px;
  margin: 0 auto;
  padding: 0 24px;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}

.v2-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.v2-brand-mark {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v2-brand-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}

.v2-nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.v2-nav-link {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  text-decoration: none;
}

.v2-nav-link:hover {
  background: var(--hover);
}

.v2-nav-meta {
  max-width: 52vw;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v2-main {
  width: min(100%, 1152px);
  margin: 0 auto;
  padding: 64px 48px 128px;
  transition: max-width 500ms ease;
}

.v2-main[data-layout="stacked"],
.v2-main[data-layout="en-only"],
.v2-main[data-layout="ko-only"] {
  max-width: 768px;
}

.v2-header {
  width: min(100%, 768px);
  margin: 0 auto 80px;
  text-align: center;
}

.v2-header h1 {
  margin: 0 0 16px;
  font-size: 48px;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: 0;
}

.v2-url {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.v2-url:hover {
  color: var(--text);
}

.v2-reader {
  display: grid;
  gap: 48px;
}

.v2-paragraph {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.v2-paragraph[data-layout="side-by-side"] {
  flex-direction: row;
  gap: 48px;
}

.v2-text {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  font-size: var(--reader-size);
  line-height: 1.7;
  transition: opacity 160ms ease;
}

h2.v2-text,
h3.v2-text,
h4.v2-text {
  font-weight: 600;
  line-height: 1.25;
}

blockquote.v2-text {
  border-left: 2px solid var(--accent-soft);
  font-style: italic;
  padding-left: 16px;
}

.v2-inline-link,
.v2-note-ref a {
  color: var(--accent);
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 0.16em;
}

.v2-note-ref {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.65em;
  font-style: normal;
  font-weight: 600;
  margin-left: 0.12em;
  vertical-align: super;
}

.v2-note-ref a {
  text-decoration: none;
}

.v2-anchor {
  display: block;
  position: relative;
  top: -84px;
  visibility: hidden;
}

.v2-source {
  opacity: 0.9;
  font-family: "Lora", ui-serif, Georgia, serif;
}

.v2-translation {
  opacity: 0.7;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}

.v2-paragraph:hover .v2-source,
.v2-paragraph:hover .v2-translation {
  opacity: 1;
}

.v2-paragraph[data-layout="stacked"] .v2-translation {
  border-left: 2px solid var(--accent-soft);
  padding-left: 16px;
}

.v2-empty {
  color: var(--muted);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
}

.v2-list-main {
  width: min(100%, 1180px);
  padding-top: 72px;
}

.v2-list-hero {
  max-width: 820px;
  margin-bottom: 42px;
}

.v2-eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.v2-list-hero h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(42px, 7vw, 82px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.v2-list-hero p:not(.v2-eyebrow) {
  max-width: 660px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.6;
}

.v2-ledger-form {
  display: inline-flex;
  align-items: end;
  gap: 10px;
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 10px;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}

.v2-ledger-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.v2-ledger-form input {
  width: 190px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  padding: 10px 12px;
  text-transform: none;
  letter-spacing: 0;
}

html[data-theme="dark"] .v2-ledger-form input {
  background: rgba(15, 23, 42, 0.78);
}

.v2-ledger-form button {
  border: 0;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  padding: 11px 16px;
}

.v2-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.v2-page-card {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(23, 32, 51, 0.04);
  color: inherit;
  padding: 24px;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.v2-page-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow);
}

.v2-card-kicker,
.v2-card-meta {
  color: var(--muted);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.v2-page-card h2 {
  margin: 18px 0 14px;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.13;
  letter-spacing: -0.02em;
}

.v2-card-url {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.v2-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
  letter-spacing: 0;
  text-transform: none;
}

.v2-card-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
}

.v2-empty-state {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  padding: 32px;
}

.v2-empty-state h2 {
  margin: 0 0 8px;
}

.v2-empty-state p {
  margin: 0;
  color: var(--muted);
}

.v2-controls {
  position: fixed;
  bottom: 32px;
  left: 50%;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: calc(100vw - 24px);
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  padding: 12px 24px;
  color: var(--control-text);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}

.v2-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 24px;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .v2-control-group {
  border-right-color: rgba(255, 255, 255, 0.1);
}

.v2-control-group:last-child {
  padding-right: 0;
  border-right: 0;
}

.v2-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
  transition: background-color 150ms ease, opacity 150ms ease;
}

.v2-controls button:hover {
  background: var(--hover);
}

.v2-controls button[aria-pressed="true"] {
  background: var(--active);
}

.v2-controls svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v2-size-small svg {
  width: 16px;
  height: 16px;
}

.v2-size-large svg {
  width: 20px;
  height: 20px;
}

#text-size {
  width: 24px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}

@media (max-width: 760px) {
  .v2-nav-inner {
    padding: 0 16px;
  }

  .v2-nav-actions {
    gap: 10px;
  }

  .v2-nav-meta {
    display: none;
  }

  .v2-main {
    padding: 56px 24px 152px;
  }

  .v2-list-main {
    padding-top: 44px;
  }

  .v2-list-hero h1 {
    font-size: 44px;
  }

  .v2-list-hero p:not(.v2-eyebrow) {
    font-size: 17px;
  }

  .v2-ledger-form {
    display: flex;
    align-items: stretch;
  }

  .v2-ledger-form label {
    flex: 1 1 auto;
  }

  .v2-ledger-form input {
    width: 100%;
  }

  .v2-page-card {
    min-height: 210px;
  }

  .v2-header {
    margin-bottom: 56px;
  }

  .v2-header h1 {
    font-size: 38px;
  }

  .v2-paragraph[data-layout="side-by-side"] {
    flex-direction: column;
    gap: 24px;
  }

  .v2-controls {
    right: 12px;
    bottom: 16px;
    left: 12px;
    transform: none;
    justify-content: flex-start;
    gap: 16px;
    overflow-x: auto;
    border-radius: 999px;
    padding: 10px 14px;
  }

  .v2-control-group {
    flex: 0 0 auto;
    gap: 6px;
    padding-right: 16px;
  }
}
