/* openvungtau – Son's notebook. Plain CSS, mobile-first.
   World: a ruled-paper notebook on a desk board, with taped photos, stamps and sticky notes.
   The paper owns the frame (headings, tape, stamps); body text stays calm and readable. */

:root {
  --desk: #C9B79A;
  --paper: #F4E9D6;
  --paper-2: #FBF5E8;         /* card paper */
  --paper-edge: #E2D3B5;
  --ink: #2B2A33;
  --ink-muted: #5F5A57;
  --clay: #C8553D;            /* large display + fills */
  --clay-ink: #A33F2B;        /* small text on paper (>= 4.5:1) */
  --sea: #6FA6A0;             /* tape, decoration */
  --sticky: #FFF0B3;
  --fill: #A33F2B;            /* pressed chip / primary button */
  --fill-ink: #FFFFFF;
  --focus: #1F5F66;
  --shadow: 0 1px 2px rgb(43 30 20 / 0.18), 0 8px 22px rgb(43 30 20 / 0.14);
  --shadow-sm: 0 1px 2px rgb(43 30 20 / 0.16), 0 3px 8px rgb(43 30 20 / 0.1);

  --body: "Noto Sans", "Noto Sans KR", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Patrick Hand", "Noto Sans", "Noto Sans KR", "Noto Sans SC", system-ui, sans-serif;
  --radius: 4px;
  --gutter: 20px;
}

:root[data-theme="dark"] {
  --desk: #18222C;
  --paper: #262B36;
  --paper-2: #2F3542;
  --paper-edge: #3A4150;
  --ink: #EFE8DA;
  --ink-muted: #B8B0A6;
  --clay: #EE8B70;
  --clay-ink: #F2A892;
  --sea: #5E9C98;
  --sticky: #4D4524;
  --fill: #EE8B70;
  --fill-ink: #2A1812;
  --focus: #8ED3CE;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 8px 22px rgb(0 0 0 / 0.35);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.5), 0 3px 8px rgb(0 0 0 / 0.3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #18222C;
    --paper: #262B36;
    --paper-2: #2F3542;
    --paper-edge: #3A4150;
    --ink: #EFE8DA;
    --ink-muted: #B8B0A6;
    --clay: #EE8B70;
    --clay-ink: #F2A892;
    --sea: #5E9C98;
    --sticky: #4D4524;
    --fill: #EE8B70;
    --fill-ink: #2A1812;
    --focus: #8ED3CE;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 8px 22px rgb(0 0 0 / 0.35);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.5), 0 3px 8px rgb(0 0 0 / 0.3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
}

h1, h2, h3, p, figure { margin: 0; }
a { color: var(--clay-ink); text-underline-offset: 3px; }

::selection { background: var(--sea); color: #10201f; }

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

.hand {
  font-family: var(--hand);
  font-weight: 400;
  letter-spacing: 0;
}
:lang(ko) .hand, :lang(zh) .hand, :lang(ru) .hand { font-weight: 700; }

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  background: var(--fill);
  color: var(--fill-ink);
  padding: 8px 14px;
  border-radius: var(--radius);
  z-index: 100;
}
.skip-link:focus { top: 8px; }

/* ---------- The sheet (notebook page) ---------- */

.sheet {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px var(--gutter) 40px;
  background: var(--paper);
}
@media (min-width: 900px) {
  body { padding: 36px 24px 56px; }
  .sheet {
    min-height: 0;
    padding: 40px 72px 56px 104px;
    box-shadow: var(--shadow);
  }
  /* binder holes */
  .sheet::before {
    content: "";
    position: absolute;
    left: 36px;
    top: 0;
    bottom: 0;
    width: 22px;
    background:
      radial-gradient(circle at 11px 11px, var(--desk) 0 9px, transparent 10px) 0 120px / 22px 280px repeat-y;
    pointer-events: none;
  }
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--paper-edge);
}
.brand {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 22px;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.site-nav a:hover { color: var(--clay-ink); }
.site-nav a[aria-current="page"] {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--clay);
  text-decoration-thickness: 3px;
  text-underline-offset: 8px;
}

.lang select {
  min-height: 44px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--paper-edge);
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--clay); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--paper-edge); }
.btn-primary {
  background: var(--fill);
  border-color: var(--fill);
  color: var(--fill-ink);
}
.btn-primary:hover { background: var(--fill); filter: brightness(1.1); }

/* ---------- Hero / greeting ---------- */

.hero {
  display: grid;
  gap: 28px;
  padding: 36px 0 12px;
}
.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.12;
  color: var(--clay);
  max-width: 17em;
  text-wrap: balance;
  transform: rotate(-0.8deg);
  transform-origin: left top;
}
/* Keep Korean words whole when lines wrap. */
:lang(ko) body { word-break: keep-all; }

/* Russian runs long and has no handwriting face, so it sets smaller than the other languages. */
:lang(ru) .hero h1 { font-size: clamp(1.8rem, 4.4vw, 2.8rem); }
.hero .lead {
  margin-top: 20px;
  font-size: 1.125rem;
  max-width: 34em;
}
.sign {
  margin-top: 10px;
  font-size: 1.8rem;
  color: var(--clay-ink);
  transform: rotate(-3deg);
  transform-origin: left center;
}

.hero-photos {
  position: relative;
  height: 220px;
  margin-top: 8px;
}
.polaroid {
  position: absolute;
  width: 200px;
  padding: 10px 10px 34px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.polaroid svg { display: block; width: 100%; height: auto; }
.polaroid-a { right: 8%; top: 0; transform: rotate(3deg); }
.polaroid-b { right: 40%; top: 56px; width: 160px; transform: rotate(-5deg); }
.tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 84px;
  height: 26px;
  margin-left: -42px;
  background: color-mix(in srgb, var(--sea) 72%, transparent);
  transform: rotate(-6deg);
}
.tape-b { background: color-mix(in srgb, var(--clay) 55%, transparent); transform: rotate(7deg); }

@media (min-width: 860px) {
  .hero { grid-template-columns: 7fr 5fr; gap: 40px; padding-top: 52px; }
  .hero-photos { height: 340px; }
  .polaroid { width: 270px; padding: 12px 12px 44px; }
  .polaroid-a { right: 2%; top: 4px; }
  .polaroid-b { right: 46%; top: 130px; width: 210px; }
}
.about .hero { grid-template-columns: 1fr; }
@media (min-width: 860px) {
  .about .hero { grid-template-columns: 7fr 5fr; }
  .about .hero-photos { height: 260px; }
}

/* ---------- Controls ---------- */

.controls {
  display: grid;
  gap: 14px;
  padding-top: 28px;
  margin-top: 8px;
  border-top: 1px dashed var(--paper-edge);
}
.search input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  font: inherit;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
}
.search input::placeholder { color: var(--ink-muted); }

.filter-group { display: grid; gap: 6px; }
.filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--paper-edge);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--clay); }
.chip[aria-pressed="true"] {
  background: var(--fill);
  border-color: var(--fill);
  color: var(--fill-ink);
  font-weight: 600;
}
@media (min-width: 760px) {
  .filter-group { grid-template-columns: 96px 1fr; align-items: center; gap: 12px; }
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-top: 20px;
  color: var(--ink-muted);
  font-size: 0.92rem;
}
.link-btn {
  background: none;
  border: 0;
  color: var(--clay-ink);
  font: inherit;
  font-weight: 600;
  padding: 10px 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Entries (place cards) ---------- */

.entries {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
  padding: 12px 0 24px;
}
@media (min-width: 720px) {
  .entries { grid-template-columns: repeat(2, 1fr); gap: 34px 30px; }
}

.entry {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 22px 20px;
  background: var(--paper-2);
  box-shadow: var(--shadow-sm);
}
.entry:nth-child(odd) { transform: rotate(-0.5deg); }
.entry:nth-child(even) { transform: rotate(0.6deg); }
.entry::before {                       /* tape holding the entry down */
  content: "";
  position: absolute;
  top: -11px;
  left: 28px;
  width: 78px;
  height: 24px;
  background: color-mix(in srgb, var(--sea) 70%, transparent);
  transform: rotate(-4deg);
}
.entry:nth-child(even)::before { left: auto; right: 28px; transform: rotate(5deg); }
.entry:hover { box-shadow: var(--shadow); }
.entry:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }

.entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.entry-cat {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.stamp {
  display: inline-block;
  padding: 1px 10px;
  border: 2px solid currentColor;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5;
  text-transform: none;
  transform: rotate(-3deg);
}
.stamp-ok { color: #1F6B3A; }
.stamp-community { color: #8A5300; border-style: dashed; }
:root[data-theme="dark"] .stamp-ok { color: #7FD49A; }
:root[data-theme="dark"] .stamp-community { color: #F0C36A; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stamp-ok { color: #7FD49A; }
  :root:not([data-theme="light"]) .stamp-community { color: #F0C36A; }
}

.entry-title { font-size: 1.4rem; line-height: 1.25; font-weight: 700; }
.entry-title button {
  all: unset;
  cursor: pointer;
}
.entry-title button::after {           /* the whole entry is the click target */
  content: "";
  position: absolute;
  inset: 0;
}
.entry-title button:focus-visible { outline: none; }
.entry-meta { color: var(--ink-muted); font-size: 0.92rem; }
.entry-note {
  font-family: var(--hand);
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--clay-ink);
}
:lang(ko) .entry-note, :lang(zh) .entry-note, :lang(ru) .entry-note {
  font-family: var(--body);
  font-size: 0.98rem;
  font-weight: 600;
}

.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px dashed var(--ink-muted);
  border-radius: 3px;
  font-size: 0.8rem;
  color: var(--ink);
}
.pill svg { flex: none; color: var(--clay-ink); }
.pill-off { color: var(--ink-muted); border-color: var(--paper-edge); }
.pill-off svg { color: var(--ink-muted); }

/* ---------- Empty / error ---------- */

.empty {
  text-align: center;
  padding: 48px 8px 64px;
  max-width: 460px;
  margin: 0 auto;
}
.empty h2 { font-size: 2rem; color: var(--clay); margin-bottom: 8px; }
.empty p { color: var(--ink-muted); }
.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}
[hidden] { display: none !important; }

/* ---------- Detail dialog ---------- */

dialog {
  width: min(660px, calc(100% - 20px));
  max-height: calc(100dvh - 20px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.4);
}
dialog::backdrop { background: rgb(20 14 8 / 0.55); }

.detail-body { position: relative; padding: 28px 22px 30px; }
.detail-close { position: absolute; top: 12px; right: 12px; }
.detail-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-right: 56px; }
.detail-title {
  font-size: 1.9rem;
  line-height: 1.2;
  color: var(--clay);
  margin: 12px 0 4px;
  padding-right: 52px;
}
.detail-sub { color: var(--ink-muted); }
.detail-photo {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  margin-top: 18px;
  padding: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transform: rotate(-0.6deg);
}

.detail-section { margin-top: 26px; }
.detail-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.sticky {
  position: relative;
  margin: 14px 4px 0;
  padding: 16px 18px;
  background: var(--sticky);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transform: rotate(-0.8deg);
}
.sticky:nth-of-type(even) { transform: rotate(0.9deg); }
.sticky::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 70px;
  height: 22px;
  margin-left: -35px;
  background: color-mix(in srgb, var(--sea) 70%, transparent);
  transform: rotate(-3deg);
}
.sticky-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--clay-ink);
  margin-bottom: 4px;
}
:root[data-theme="dark"] .sticky-label { color: #F5C9B8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sticky-label { color: #F5C9B8; }
}

.facts { display: grid; grid-template-columns: 1fr; margin: 0; }
.facts div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--paper-edge);
}
.facts dt { color: var(--ink-muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
@media (min-width: 560px) {
  .facts { grid-template-columns: 1fr 1fr; column-gap: 28px; }
}

.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

/* ---------- About ---------- */

.prose {
  max-width: 40rem;
  padding: 24px 0 8px;
}
.prose h2 {
  font-size: 1.9rem;
  line-height: 1.2;
  color: var(--clay);
  margin: 36px 0 8px;
}
.prose h2:first-child { margin-top: 0; }
.prose p { font-size: 1.05rem; }
.note {
  margin-top: 40px;
  padding: 18px 20px;
  background: var(--sticky);
  box-shadow: var(--shadow-sm);
  transform: rotate(-0.5deg);
}
.note h3 { font-size: 1.4rem; color: var(--clay-ink); margin-bottom: 6px; }
:root[data-theme="dark"] .note h3 { color: #F5C9B8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .note h3 { color: #F5C9B8; }
}
.about-actions { justify-content: flex-start; margin-top: 36px; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--paper-edge);
  color: var(--ink-muted);
  font-size: 0.9rem;
}
.footer-links { display: flex; gap: 20px; margin-top: 8px; }
.footer-links a { padding: 8px 0; }

@media (prefers-reduced-motion: no-preference) {
  .chip, .btn, .icon-btn, .entry { transition: background-color 0.2s, border-color 0.2s, box-shadow 0.25s, filter 0.2s; }
}
@media (prefers-reduced-motion: reduce) {
  .hero h1, .sign, .entry, .sticky, .note, .polaroid { transition: none; }
}

/* ---------- Suggest widget ---------- */

.nav-suggest { display: none; min-height: 40px; padding: 0 16px; }
@media (min-width: 720px) { .nav-suggest { display: inline-flex; } }

.channels { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; }
.channel {
  display: grid;
  grid-template-columns: 24px auto 1fr;
  align-items: center;
  gap: 4px 12px;
  min-height: 56px;
  padding: 10px 16px;
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}
.channel:hover { border-color: var(--clay); box-shadow: var(--shadow-sm); }
.channel svg { color: var(--clay-ink); }
.channel-name { font-weight: 700; }
.channel-note { color: var(--ink-muted); font-size: 0.92rem; text-align: right; }
@media (max-width: 479px) {
  .channel { grid-template-columns: 24px 1fr; }
  .channel-note { grid-column: 2; text-align: left; }
}
.suggest-hint { margin-top: 24px; font-size: 0.95rem; }
