@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/be-vietnam-0.d39766c4c940.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/be-vietnam-1.cff16857fd04.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f4f0e9;
  --surface: #fffdfa;
  --ink: #2b2b2b;
  --heading: #2e0903;
  --muted: #6a6058;
  --line: #d8cdbf;
  --wine: #510d00;
  --copper: #a3541b;
  --active: #f7eee1;
  --body: 'Be Vietnam Pro', system-ui, sans-serif;
  --display: Georgia, 'Times New Roman', serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.7 var(--body);
}

a { color: var(--wine); text-underline-offset: .22em; }

:focus-visible {
  outline: 3px solid var(--copper);
  outline-offset: 4px;
}

button, input, textarea { font: inherit; }
button, summary { cursor: pointer; }

h1, h2, h3 {
  color: var(--heading);
  font: 400 2rem/1.18 var(--display);
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

h1 {
  margin: 0 0 .38em;
  font-size: clamp(2.45rem, 6vw, 4.25rem);
}

p { overflow-wrap: anywhere; }

.wrap {
  width: min(1160px, calc(100% - 48px));
  margin-inline: auto;
}

.skip {
  position: absolute;
  top: 10px;
  left: 14px;
  z-index: 1;
  padding: .65rem 1rem;
  background: var(--surface);
  transform: translateY(-160%);
}

.skip:focus { transform: none; }

.masthead, .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-block: 24px;
}

.masthead { border-bottom: 1px solid var(--line); }

.brand {
  color: var(--heading);
  font: 1.65rem/1.1 var(--display);
  text-decoration: none;
}

.brand small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font: .73rem/1.4 var(--body);
}

.mast-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: .85rem;
}

.mast-nav a, .footer a { color: inherit; }

.main { padding-block: clamp(34px, 6vw, 72px) clamp(48px, 8vw, 92px); }

.footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
}

.page-intro { max-width: 72ch; }

.lead {
  max-width: 65ch;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin-block: .5rem 1.7rem;
  white-space: pre-line;
}

.empty {
  margin-top: 36px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.article-index { margin-block-start: clamp(30px, 6vw, 64px); }

.article-index-heading, .article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
}

.article-index-heading {
  justify-content: space-between;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}

.article-index-heading h2 { margin: 0; }
.article-category { color: var(--wine); font-size: .85rem; font-weight: 600; }

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.article-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
}

.article-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
}

.article-card a:hover { background: var(--active); }

.card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(20px, 3vw, 32px);
}

.card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.article-card h3 {
  margin: .4rem 0 .65rem;
  font-size: clamp(1.55rem, 2.6vw, 2rem);
}

.article-date { color: var(--muted); font-size: .82rem; }

.card-summary {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: .93rem;
}

.read { display: block; margin-top: auto; font-size: .84rem; font-weight: 600; }
.article-pagination { justify-content: center; font-size: .88rem; }

.reading { max-width: 760px; margin-inline: auto; }
.reading-intro h1 { margin-top: .38em; }
.reading-intro .lead { margin-block: 1rem 1.5rem; }
.article-cover { display: block; width: 100%; height: auto; margin-block-start: 1.5rem; }
.back { display: inline-block; margin-bottom: 1.85rem; font-size: .92rem; }

.article-body {
  margin-top: clamp(24px, 5vw, 42px);
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: clamp(1rem, 2vw, 1.125rem);
  line-height: 1.85;
}

.article-body p { margin: 1em 0; }

.article-body, .rich-surface { overflow-wrap: anywhere; }
.article-body h2, .rich-surface h2 { margin: 1.5em 0 .45em; }
.article-body h3, .rich-surface h3 { margin: 1.35em 0 .45em; font-size: 1.45rem; }

.article-body blockquote, .rich-surface blockquote {
  margin: 1.3em 0;
  padding: .1em 0 .1em 1em;
  border-left: 3px solid var(--copper);
  color: var(--muted);
}

.article-body blockquote > :first-child, .rich-surface blockquote > :first-child { margin-top: 0; }
.article-body blockquote > :last-child, .rich-surface blockquote > :last-child { margin-bottom: 0; }
.article-body ul, .article-body ol, .rich-surface ul, .rich-surface ol { padding-inline-start: 1.6em; }
.article-body figure, .rich-surface figure { margin: 1.65em 0; }
.article-body img, .rich-surface img { display: block; max-width: 100%; height: auto; margin-inline: auto; }

.article-body figcaption, .rich-surface figcaption {
  padding-top: .6em;
  color: var(--muted);
  font-size: .86rem;
  text-align: center;
}

.signin { max-width: 520px; margin-inline: auto; }
.signin h1, .owner-heading h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
.signin h1 { margin-bottom: 1.2rem; }

.owner-heading, .library-head, .editor-status, .actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 15px;
}

.owner-heading {
  justify-content: space-between;
  margin-bottom: clamp(25px, 5vw, 44px);
}

.owner-heading h1 { margin: 0; }
.editor-layout { display: grid; grid-template-columns: minmax(230px, 290px) minmax(0, 1fr); gap: clamp(24px, 5vw, 55px); }
.library, .editor { min-width: 0; }
.library-head { justify-content: space-between; margin-bottom: 14px; }
.library h2, .editor > h2, .editor .form-panel > h2 { margin: 0; font-size: 1.65rem; }
.editor > h2, .editor .form-panel > h2 { margin-bottom: .8rem; }
.library-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.library-list li { border-bottom: 1px solid var(--line); }
.library-list a {
  display: grid;
  padding: 11px 10px;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.library-list a:hover, .library-list a[aria-current="page"] { background: var(--active); }
.library-list span { font-weight: 600; }
.library-list small { color: var(--muted); }
.editor-status { font-size: .85rem; margin-bottom: 1rem; }
.editor-status span { font-weight: 600; color: var(--wine); }

.form-panel {
  padding: clamp(18px, 4vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
}

.field + .field { margin-top: 1.2rem; }
.form-panel label { display: block; margin-bottom: 6px; font-weight: 600; }
.form-panel input:not([type="hidden"]), .form-panel textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .65rem .8rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #897d70;
  border-radius: 3px;
}

.form-panel textarea { resize: vertical; }
.form-panel input[readonly] { background: var(--paper); }
.field-note { margin: 6px 0 0; }
.field-note, .optional { color: var(--muted); font-size: .8rem; font-weight: 400; }
.optional { margin-left: .28rem; }
.actions { margin-top: 1.5rem; }

.draft-form [hidden] { display: none; }
.draft-form legend, .editor-label { font-weight: 600; }
.editor-label { margin: 0 0 6px; }

.cover-editor, .rich-options {
  min-inline-size: 0;
  margin: 0 0 1rem;
  padding: .75rem 1rem 1rem;
  border: 1px solid var(--line);
}

.cover-editor legend, .rich-options legend { padding: 0 .35rem; }
.cover-meta, .cover-editor [data-cover-remove], .rich-options input + label { margin-top: .7rem; }
.cover-preview { display: block; max-width: 100%; width: min(240px, 100%); height: auto; margin: 0 0 .65rem; }

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: .5rem;
}

.rich-toolbar button {
  min-height: 44px;
  min-width: 44px;
  padding: .4rem .56rem;
  color: var(--wine);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: .79rem;
}

.rich-toolbar button:hover, .rich-toolbar button[aria-pressed="true"], .rich-toolbar button[aria-expanded="true"] {
  background: var(--active);
  border-color: var(--copper);
}

.rich-toolbar button:disabled { cursor: default; opacity: .6; }
.rich-options .actions { margin-top: .7rem; }

.rich-surface {
  min-height: 17rem;
  padding: .75rem .9rem;
  background: #fff;
  border: 1px solid #897d70;
  border-radius: 3px;
  line-height: 1.75;
}

.rich-surface p { margin: 0 0 .8em; }
.editor-feedback:not(:empty) { color: var(--wine); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .57rem .92rem;
  color: #fff;
  background: var(--wine);
  border: 1px solid var(--wine);
  border-radius: 3px;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
}

.button:hover { background: var(--heading); }
.button-secondary { color: var(--wine); background: var(--surface); }
.button-secondary:hover { background: var(--active); }

.notice {
  padding: 13px 16px;
  margin: 0 0 1.25rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--wine);
  background: var(--surface);
  color: var(--wine);
  font-size: .9rem;
}

.notice-error { border-left-color: #9e281f; }
.publish, .withdraw { margin-top: 1.65rem; padding: 1.2rem 0 0; border-top: 1px solid var(--line); }
.publish p, .withdraw p { display: block; color: var(--muted); font-size: .88rem; }
.withdraw summary { color: var(--wine); font-weight: 600; }

@media (max-width: 800px) {
  .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 540px) {
  .wrap { width: calc(100% - 32px); }
  .masthead { align-items: flex-start; }
  .brand { font-size: 1.45rem; }
  .article-grid { grid-template-columns: minmax(0, 1fr); }
}
