/* ==========================================================================
   AsKrs design system
   Restraint is the point: neutral surfaces, one accent, type doing the work.
   ========================================================================== */

:root {
  /* Surfaces */
  --askrs-bg:          #ffffff;
  --askrs-bg-soft:     #f7f8fa;
  --askrs-border:      #e8e8eb;
  --askrs-border-strong: #d8d9de;

  /* Text — measured against #ffffff:
     ink 17.9:1, muted 5.30:1, accent 6.57:1. All pass WCAG AA for body text. */
  --askrs-ink:         #171719;
  --askrs-muted:       #6b6b70;
  --askrs-accent:      #0b5fa5;
  --askrs-accent-soft: #eef4fa;

  /* A single reading column. Long Korean lines tire the eye faster than Latin. */
  --askrs-measure:     780px;
  --askrs-wide:        1120px;
  --askrs-gutter:      20px;

  --askrs-radius:      6px;
  --askrs-radius-sm:   4px;

  /* Korean text needs more leading and slightly tighter tracking than Latin. */
  --askrs-font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
                'Segoe UI', Roboto, 'Apple SD Gothic Neo', 'Noto Sans KR',
                'Malgun Gothic', sans-serif;
  --askrs-font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
                     'D2Coding', monospace;

  --askrs-body-size:   17px;
  --askrs-body-lh:     1.78;
  --askrs-tracking:    -0.01em;
}

/* --------------------------------------------------------------- base --- */

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--askrs-bg);
  color: var(--askrs-ink);
  font-family: var(--askrs-font);
  font-size: var(--askrs-body-size);
  line-height: var(--askrs-body-lh);
  letter-spacing: var(--askrs-tracking);
  font-feature-settings: 'tnum' 0;
  word-break: keep-all;          /* Korean wraps on word units, not syllables. */
  overflow-wrap: break-word;
}

a { color: var(--askrs-accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--askrs-accent);
  outline-offset: 2px;
  border-radius: var(--askrs-radius-sm);
}

img, video { max-width: 100%; height: auto; }

/* Blocksy sets its own container widths; these keep the reading column honest. */
.askrs-wrap { width: 100%; max-width: var(--askrs-wide); margin-inline: auto; padding-inline: var(--askrs-gutter); }
.askrs-measure { width: 100%; max-width: var(--askrs-measure); margin-inline: auto; }

/* ------------------------------------------------------------ headings --- */

h1, h2, h3, h4 {
  color: var(--askrs-ink);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.34;
  text-wrap: pretty;
}

.entry-title, .askrs-article__title { font-size: clamp(27px, 4.6vw, 40px); line-height: 1.32; margin: 0 0 14px; }
.askrs-section__title { font-size: 19px; letter-spacing: -0.02em; margin: 0; }

/* ------------------------------------------------------------- header --- */

.askrs-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--askrs-border);
}
.askrs-header__inner {
  display: flex; align-items: center; gap: 22px;
  height: 58px;
  max-width: var(--askrs-wide); margin-inline: auto; padding-inline: var(--askrs-gutter);
}
.askrs-header__logo {
  font-weight: 800; font-size: 18px; letter-spacing: -0.03em;
  color: var(--askrs-ink); text-decoration: none; flex: none;
}
.askrs-header__nav { display: flex; gap: 20px; margin-inline-start: 6px; flex: 1 1 auto; }
.askrs-header__nav a {
  color: var(--askrs-muted); text-decoration: none; font-size: 15.5px; font-weight: 500;
  padding: 6px 0; white-space: nowrap;
}
.askrs-header__nav a:hover, .askrs-header__nav a[aria-current] { color: var(--askrs-ink); }
.askrs-header__search {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: none;
  border: 1px solid var(--askrs-border); border-radius: var(--askrs-radius);
  background: #fff; color: var(--askrs-muted); cursor: pointer;
}
.askrs-header__search:hover { color: var(--askrs-ink); border-color: var(--askrs-border-strong); }
.askrs-header__toggle { display: none; }

@media (max-width: 780px) {
  .askrs-header__inner { height: 54px; gap: 12px; }
  .askrs-header__nav { display: none; }
  .askrs-header__nav.is-open {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; inset-inline: 0; top: 54px;
    background: #fff; border-bottom: 1px solid var(--askrs-border);
    padding: 6px var(--askrs-gutter) 12px;
  }
  .askrs-header__nav.is-open a { padding: 12px 0; font-size: 16px; border-bottom: 1px solid var(--askrs-border); }
  .askrs-header__nav.is-open a:last-child { border-bottom: 0; }
  /* Both controls sit on the right so the logo keeps the left edge to itself. */
  .askrs-header__search { margin-inline-start: auto; }
  .askrs-header__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border: 1px solid var(--askrs-border); border-radius: var(--askrs-radius);
    background: #fff; color: var(--askrs-muted); cursor: pointer;
  }
}

/* --------------------------------------------------------- search form --- */

.askrs-searchbar { border-bottom: 1px solid var(--askrs-border); background: var(--askrs-bg-soft); display: none; }
.askrs-searchbar.is-open { display: block; }
.askrs-searchbar form { display: flex; gap: 8px; max-width: var(--askrs-wide); margin-inline: auto; padding: 12px var(--askrs-gutter); }
.askrs-searchbar input[type="search"] {
  flex: 1; height: 42px; padding: 0 12px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--askrs-border-strong); border-radius: var(--askrs-radius); background: #fff; color: var(--askrs-ink);
}
.askrs-searchbar button {
  height: 42px; padding: 0 16px; font-family: inherit; font-size: 15px; font-weight: 600;
  border: 0; border-radius: var(--askrs-radius); background: var(--askrs-accent); color: #fff; cursor: pointer;
}

/* -------------------------------------------------------------- cards --- */

.askrs-grid { display: grid; gap: 22px 20px; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); list-style: none; margin: 0; padding: 0; }
.askrs-grid--wide { grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); }

.askrs-card { margin: 0; }
.askrs-card__link { display: block; color: inherit; text-decoration: none; }
.askrs-card__media {
  display: block; aspect-ratio: 16 / 10; overflow: hidden;
  border: 1px solid var(--askrs-border); border-radius: var(--askrs-radius);
  background: var(--askrs-bg-soft); margin-bottom: 11px;
}
.askrs-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .28s ease; }
.askrs-card__link:hover .askrs-card__media img { transform: scale(1.018); }

/* No thumbnail is a normal state, not a broken layout. */
.askrs-card__media--empty { display: grid; place-items: center; }
.askrs-card__media--empty span { font-size: 13px; font-weight: 600; color: var(--askrs-muted); letter-spacing: -0.01em; }

.askrs-card__cat { display: block; font-size: 12.5px; font-weight: 600; color: var(--askrs-accent); margin-bottom: 4px; }
.askrs-card__title { font-size: 16.5px; font-weight: 600; line-height: 1.48; letter-spacing: -0.018em; margin: 0 0 5px; color: var(--askrs-ink); }
.askrs-card__link:hover .askrs-card__title { text-decoration: underline; text-underline-offset: 0.16em; }
.askrs-card__excerpt { font-size: 14.5px; line-height: 1.62; color: var(--askrs-muted); margin: 0 0 6px; }
.askrs-card__date { font-size: 12.5px; color: var(--askrs-muted); }

/* --------------------------------------------------------------- home --- */

.askrs-intro { padding: 40px 0 8px; }
.askrs-intro p { font-size: 18px; line-height: 1.66; color: var(--askrs-muted); margin: 0; max-width: 620px; letter-spacing: -0.015em; }
.askrs-intro strong { color: var(--askrs-ink); font-weight: 700; display: block; font-size: 22px; margin-bottom: 6px; letter-spacing: -0.028em; }

.askrs-section { padding: 30px 0; border-top: 1px solid var(--askrs-border); }
.askrs-section:first-of-type { border-top: 0; }
.askrs-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.askrs-more { font-size: 14.5px; font-weight: 600; color: var(--askrs-muted); text-decoration: none; white-space: nowrap; }
.askrs-more:hover { color: var(--askrs-accent); }

.askrs-empty { color: var(--askrs-muted); font-size: 15px; padding: 10px 0 4px; margin: 0; }

/* ------------------------------------------------------------ article --- */

.askrs-article { padding: 34px 0 10px; }
.askrs-article__eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--askrs-muted); margin-bottom: 12px; }
.askrs-article__eyebrow a { color: var(--askrs-accent); font-weight: 600; text-decoration: none; }
.askrs-article__lead { font-size: 18px; line-height: 1.7; color: var(--askrs-muted); margin: 0 0 26px; letter-spacing: -0.014em; }

.askrs-prose > * { margin-block: 0 1.32em; }
.askrs-prose > :last-child { margin-bottom: 0; }
.askrs-prose h2 { font-size: 22px; margin-top: 2.1em; margin-bottom: 0.62em; padding-top: 0.2em; }
.askrs-prose h3 { font-size: 18.5px; margin-top: 1.7em; margin-bottom: 0.5em; font-weight: 650; }
.askrs-prose p { margin-bottom: 1.32em; }
.askrs-prose ul, .askrs-prose ol { padding-inline-start: 1.35em; margin-bottom: 1.32em; }
.askrs-prose li { margin-bottom: 0.46em; }
.askrs-prose li::marker { color: var(--askrs-muted); }
.askrs-prose strong { font-weight: 700; }

.askrs-prose blockquote {
  margin: 1.6em 0; padding: 2px 0 2px 16px;
  border-inline-start: 3px solid var(--askrs-border-strong);
  color: var(--askrs-muted);
}
.askrs-prose blockquote p:last-child { margin-bottom: 0; }

/* Tables must survive a 375px screen rather than push the page sideways. */
.askrs-prose .askrs-table-scroll { overflow-x: auto; margin-bottom: 1.5em; -webkit-overflow-scrolling: touch; }
.askrs-prose table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 460px; }
.askrs-prose th, .askrs-prose td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--askrs-border); vertical-align: top; line-height: 1.6; }
.askrs-prose thead th { background: var(--askrs-bg-soft); font-weight: 650; font-size: 14px; color: var(--askrs-ink); white-space: nowrap; }

.askrs-prose figure { margin: 1.7em 0; }
.askrs-prose figcaption { font-size: 13.5px; color: var(--askrs-muted); margin-top: 8px; line-height: 1.6; }
.askrs-prose img { border-radius: var(--askrs-radius); display: block; }

.askrs-prose code {
  font-family: var(--askrs-font-mono); font-size: 0.88em;
  background: var(--askrs-bg-soft); border: 1px solid var(--askrs-border);
  border-radius: var(--askrs-radius-sm); padding: 1px 5px; word-break: break-all;
}
.askrs-prose pre {
  font-family: var(--askrs-font-mono); font-size: 14px; line-height: 1.62;
  background: var(--askrs-bg-soft); border: 1px solid var(--askrs-border);
  border-radius: var(--askrs-radius); padding: 14px 16px; overflow-x: auto; margin-bottom: 1.5em;
}
.askrs-prose pre code { background: none; border: 0; padding: 0; white-space: pre; word-break: normal; }

/* A pasted URL must not widen the page. */
.askrs-prose a { word-break: break-word; overflow-wrap: anywhere; }

.askrs-article__foot { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--askrs-border); font-size: 13.5px; color: var(--askrs-muted); }

/* ------------------------------------------------------------- archive --- */

.askrs-archive__head { padding: 36px 0 22px; border-bottom: 1px solid var(--askrs-border); margin-bottom: 26px; }
.askrs-archive__title { font-size: clamp(24px, 4vw, 30px); margin: 0 0 8px; }
.askrs-archive__desc { font-size: 16px; color: var(--askrs-muted); margin: 0; max-width: 620px; line-height: 1.66; }
.askrs-archive__count { font-size: 13.5px; color: var(--askrs-muted); margin-top: 10px; }

.askrs-pagination { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 40px 0 8px; }
.askrs-pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 10px;
  border: 1px solid var(--askrs-border); border-radius: var(--askrs-radius);
  color: var(--askrs-muted); text-decoration: none; font-size: 14.5px; font-weight: 600;
}
.askrs-pagination .page-numbers:hover { border-color: var(--askrs-border-strong); color: var(--askrs-ink); }
.askrs-pagination .page-numbers.current { background: var(--askrs-ink); border-color: var(--askrs-ink); color: #fff; }

/* -------------------------------------------------------------- footer --- */

.askrs-footer { border-top: 1px solid var(--askrs-border); background: var(--askrs-bg-soft); margin-top: 60px; padding: 34px 0 40px; }
.askrs-footer__inner { max-width: var(--askrs-wide); margin-inline: auto; padding-inline: var(--askrs-gutter); display: flex; flex-wrap: wrap; gap: 26px 48px; }
.askrs-footer__brand { font-weight: 800; font-size: 16px; letter-spacing: -0.03em; color: var(--askrs-ink); }
.askrs-footer__tag { font-size: 13.5px; color: var(--askrs-muted); margin-top: 6px; max-width: 260px; line-height: 1.6; }
.askrs-footer__col h2 { font-size: 13px; font-weight: 650; color: var(--askrs-muted); margin: 0 0 10px; letter-spacing: 0.01em; }
.askrs-footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.askrs-footer__col a {
  color: var(--askrs-ink); text-decoration: none; font-size: 14.5px;
  /* Footer links are list items, not inline text: 24px minimum target. */
  display: inline-flex; align-items: center; min-height: 24px;
}
.askrs-footer__col a:hover { color: var(--askrs-accent); text-decoration: underline; text-underline-offset: 0.16em; }
.askrs-footer__legal { width: 100%; border-top: 1px solid var(--askrs-border); padding-top: 18px; font-size: 13px; color: var(--askrs-muted); }

/* ----------------------------------------------------------------- 404 --- */

.askrs-404 { padding: 60px 0 20px; text-align: start; }
.askrs-404__code { font-size: 13.5px; font-weight: 700; color: var(--askrs-muted); letter-spacing: 0.06em; margin-bottom: 10px; }
.askrs-404__title { font-size: clamp(23px, 4vw, 29px); margin: 0 0 10px; }
.askrs-404__desc { color: var(--askrs-muted); margin: 0 0 24px; font-size: 16px; }
.askrs-404__links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 34px; }
.askrs-404__links a {
  border: 1px solid var(--askrs-border); border-radius: var(--askrs-radius);
  padding: 8px 14px; text-decoration: none; color: var(--askrs-ink); font-size: 14.5px; font-weight: 600;
}
.askrs-404__links a:hover { border-color: var(--askrs-accent); color: var(--askrs-accent); }

/* ------------------------------------------------------------- search --- */

.askrs-searchresults__head { padding: 34px 0 20px; border-bottom: 1px solid var(--askrs-border); margin-bottom: 24px; }
.askrs-searchresults__q { font-weight: 700; color: var(--askrs-ink); }

/* -------------------------------------------------------- small screens --- */

@media (max-width: 560px) {
  :root { --askrs-body-size: 16.5px; --askrs-gutter: 16px; }
  .askrs-intro { padding: 28px 0 4px; }
  .askrs-intro strong { font-size: 20px; }
  .askrs-intro p { font-size: 16.5px; }
  .askrs-section { padding: 26px 0; }
  .askrs-grid { grid-template-columns: 1fr; gap: 20px; }
  .askrs-article { padding: 26px 0 8px; }
  .askrs-prose h2 { font-size: 20px; }
  .askrs-prose h3 { font-size: 17.5px; }
  .askrs-footer__inner { gap: 24px 32px; }
}

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