@layer base, layout, components, responsive;

@layer base {
  .rna-site {
    --rna-paper: #f6f4ef;
    --rna-surface: #fffefa;
    --rna-ink: #242a2e;
    --rna-muted: #5d666a;
    --rna-line: #dedbd3;
    --rna-orange: #b64c18;
    --rna-orange-dark: #85370f;
    --rna-orange-soft: #f5e8dc;
    width: 100%;
    min-height: 100vh;
    overflow-x: clip;
    background: var(--rna-paper);
    color: var(--rna-ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
  }

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

  .rna-site h1,
  .rna-site h2,
  .rna-site h3,
  .rna-site p,
  .rna-site figure { margin-top: 0; }

  .rna-site h1,
  .rna-site h2,
  .rna-site h3 { color: var(--rna-ink); line-height: 1.18; letter-spacing: -0.035em; }

  .rna-site a { color: inherit; }
  .rna-site a:focus-visible,
  .rna-site button:focus-visible,
  .rna-site input:focus-visible { outline: 3px solid #d16a30; outline-offset: 3px; }
  .rna-site img,
  .rna-site video,
  .rna-site iframe { max-width: 100%; height: auto; }
  .rna-site button,
  .rna-site input { font: inherit; }
}

@layer layout {
  .rna-container {
    width: min(100% - 56px, 1200px);
    margin-inline: auto;
  }

  .rna-header {
    width: 100%;
    background: var(--rna-ink);
    color: #fffaf4;
    border-bottom: 4px solid var(--rna-orange);
  }

  .rna-brand-row { display: flex; justify-content: center; padding: 25px 0 20px; }
  .rna-brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; }
  .rna-brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 13px 13px 13px 3px;
    background: var(--rna-orange);
    color: #fff;
    font-size: 26px;
    font-weight: 850;
    line-height: 1;
  }
  .rna-brand-copy { display: grid; gap: 1px; }
  .rna-brand-name { font-size: 23px; font-weight: 800; letter-spacing: -.045em; line-height: 1.1; }
  .rna-brand-note { color: #d6d5d0; font-size: 12px; letter-spacing: .045em; }

  .rna-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 5px 8px;
    width: 100%;
    padding: 0 0 18px;
  }
  .rna-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #f6f3ed;
    font-size: 14px;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
  }
  .rna-nav a:hover,
  .rna-nav a[aria-current="page"],
  .rna-nav a[aria-current="true"] { border-color: #e5a174; background: #49372e; color: #fff; }

  .rna-main { padding-block: 64px 88px; }
  .rna-home-intro,
  .rna-archive-intro { max-width: 800px; margin: 0 auto 58px; text-align: center; }
  .rna-eyebrow {
    margin-bottom: 12px;
    color: var(--rna-orange-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
    line-height: 1.4;
    text-transform: uppercase;
  }
  .rna-home-intro h1,
  .rna-archive-intro h1 { max-width: 760px; margin: 0 auto 18px; font-size: clamp(36px, 5.2vw, 62px); }
  .rna-lead { max-width: 700px; margin: 0 auto; color: var(--rna-muted); font-size: clamp(18px, 2vw, 21px); line-height: 1.55; }
  .rna-archive-note { margin: 16px 0 0; color: var(--rna-muted); }

  .rna-search { max-width: 620px; margin: 30px auto 0; text-align: left; }
  .rna-search label { display: block; margin-bottom: 8px; color: var(--rna-ink); font-size: 14px; font-weight: 700; }
  .rna-search-row { display: flex; gap: 9px; }
  .rna-search input {
    min-width: 0;
    min-height: 50px;
    flex: 1;
    padding: 11px 15px;
    border: 1px solid #c9c5bb;
    border-radius: 9px;
    background: var(--rna-surface);
    color: var(--rna-ink);
  }
  .rna-search input::placeholder { color: #667074; opacity: 1; }
  .rna-search button {
    min-height: 50px;
    padding: 10px 23px;
    border: 0;
    border-radius: 9px;
    background: var(--rna-orange);
    color: #fff;
    cursor: pointer;
    font-weight: 750;
  }
  .rna-search button:hover { background: var(--rna-orange-dark); }

  .rna-section { margin-top: 54px; }
  .rna-section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; }
  .rna-section-heading .rna-eyebrow { margin-bottom: 7px; }
  .rna-section-heading h2,
  .rna-category-panel h2 { margin-bottom: 0; font-size: clamp(26px, 3vw, 36px); }
  .rna-grid { display: grid; min-width: 0; }
  .rna-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .rna-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--rna-line);
    border-radius: 14px;
    background: var(--rna-surface);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  }
  .rna-card:hover { transform: translateY(-3px); border-color: #d7a27f; box-shadow: 0 12px 26px #27241e12; }
  .rna-card-link { display: flex; height: 100%; flex-direction: column; color: inherit; text-decoration: none; }
  .rna-card-media { display: grid; min-height: 10px; place-items: center; overflow: hidden; background: #ebe6dc; }
  .rna-card-media:empty { display: none; }
  .rna-card-media img { display: block; width: 100%; max-height: 230px; object-fit: cover; }
  .rna-card-body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; padding: 23px 23px 20px; }
  .rna-card-category { margin-bottom: 10px; color: var(--rna-orange-dark); font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
  .rna-card h2 { margin-bottom: 11px; font-size: 23px; }
  .rna-card-excerpt { margin-bottom: 20px; color: var(--rna-muted); font-size: 15px; line-height: 1.6; }
  .rna-card-cta { margin-top: auto; color: var(--rna-orange-dark); font-size: 14px; font-weight: 750; }
  .rna-card-link:hover .rna-card-cta { text-decoration: underline; text-underline-offset: 3px; }

  .rna-category-panel { margin-top: 66px; padding: 29px; border: 1px solid var(--rna-line); border-radius: 15px; background: #eeebe4; text-align: center; }
  .rna-category-panel .rna-eyebrow { margin-bottom: 8px; }
  .rna-nav-panel { padding: 19px 0 0; }
  .rna-nav-panel a { border-color: #d3cec3; background: #fffefa; color: var(--rna-ink); }
  .rna-nav-panel a:hover,
  .rna-nav-panel a[aria-current="page"],
  .rna-nav-panel a[aria-current="true"] { border-color: var(--rna-orange); background: var(--rna-orange); color: #fff; }

  .rna-article { max-width: 1060px; margin-inline: auto; }
  .rna-article-header { max-width: 850px; margin: 0 auto 40px; text-align: center; }
  .rna-article-header h1 { margin: 0 auto 18px; font-size: clamp(36px, 5vw, 60px); overflow-wrap: anywhere; }
  .rna-dates { color: var(--rna-muted); font-size: 14px; }
  .rna-article-layout { display: grid; grid-template-columns: minmax(0, min(740px, 1fr)) minmax(200px, 240px); align-items: start; justify-content: center; gap: 44px; }
  .rna-entry { min-width: 0; color: #303639; font-size: 18px; line-height: 1.78; overflow-wrap: anywhere; }
  .rna-entry > * { max-width: 100%; }
  .rna-entry h2 { margin: 2em 0 .7em; font-size: clamp(27px, 3vw, 36px); }
  .rna-entry h3 { margin: 1.7em 0 .55em; font-size: 24px; }
  .rna-entry p { margin: 0 0 1.35em; }
  .rna-entry ul,
  .rna-entry ol { margin: 0 0 1.5em; padding-left: 1.4em; }
  .rna-entry li { margin: .35em 0; padding-left: .2em; }
  .rna-entry a { color: var(--rna-orange-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
  .rna-entry blockquote { margin: 1.7em 0; padding: 6px 0 6px 22px; border-left: 4px solid var(--rna-orange); color: #454b4e; }
  .rna-entry hr { margin: 2.5em 0; border: 0; border-top: 1px solid var(--rna-line); }
  .rna-entry figure { margin: 1.7em 0; }
  .rna-entry figcaption { margin-top: 8px; color: var(--rna-muted); font-size: 14px; }
  .rna-entry table { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse; border-spacing: 0; font-size: 15px; line-height: 1.5; -webkit-overflow-scrolling: touch; }
  .rna-entry th,
  .rna-entry td { min-width: 120px; padding: 11px 13px; border: 1px solid #d5d1c8; text-align: left; vertical-align: top; }
  .rna-entry th { background: #ece8df; color: var(--rna-ink); font-weight: 750; }
  .rna-entry tr:nth-child(even) td { background: #fbfaf6; }
  .rna-entry pre { max-width: 100%; overflow: auto; padding: 16px; border-radius: 9px; background: #eae7e0; font-size: 14px; }
  .rna-entry code { overflow-wrap: anywhere; }
  .rna-reading-note { position: sticky; top: 20px; padding: 20px; border-top: 3px solid var(--rna-orange); background: #eeebe4; color: #454b4e; font-size: 14px; line-height: 1.6; }
  .rna-reading-note .rna-eyebrow { margin-bottom: 8px; }
  .rna-reading-note p:last-child { margin-bottom: 0; }

  .rna-site :is(.pagination, .nav-links, .page-numbers) { color: var(--rna-ink); }
  .rna-site :is(.pagination, .nav-links) { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 30px; }
  .rna-site .page-numbers { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; padding: 8px 13px; border: 1px solid var(--rna-line); border-radius: 9px; background: var(--rna-surface); text-decoration: none; }
  .rna-site .page-numbers.current { border-color: var(--rna-orange); background: var(--rna-orange); color: #fff; }

  .rna-footer { width: 100%; padding: 36px 0 40px; border-top: 1px solid #4b5051; background: #242a2e; color: #f4f1eb; }
  .rna-footer-inner { text-align: center; }
  .rna-footer-brand { color: #fff; font-size: 20px; font-weight: 800; letter-spacing: -.03em; text-decoration: none; }
  .rna-footer-inner p { max-width: 660px; margin: 8px auto 0; color: #dedbd4; }
  .rna-footer-inner .rna-footer-meta { color: #bfc1bd; font-size: 13px; }
}

@layer responsive {
  @media (min-width: 1024px) {
    .rna-card-grid { gap: 24px; }
    .rna-main { padding-top: 76px; }
  }

  @media (min-width: 768px) and (max-width: 1023px) {
    .rna-container { width: min(100% - 40px, 920px); }
    .rna-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rna-article-layout { grid-template-columns: minmax(0, 1fr) 205px; gap: 26px; }
    .rna-nav { gap: 3px 4px; }
    .rna-nav a { padding-inline: 10px; font-size: 13px; }
  }

  @media (max-width: 767px) {
    .rna-container { width: min(100% - 32px, 600px); }
    .rna-brand-row { padding: 19px 0 16px; }
    .rna-brand-mark { width: 42px; height: 42px; }
    .rna-brand-name { font-size: 21px; }
    .rna-brand-note { font-size: 11px; }
    .rna-nav { gap: 4px 5px; padding: 0 0 15px; }
    .rna-nav a { min-height: 44px; padding: 8px 11px; font-size: 13px; }
    .rna-main { padding-block: 44px 60px; }
    .rna-home-intro,
    .rna-archive-intro { margin-bottom: 40px; }
    .rna-home-intro h1,
    .rna-archive-intro h1,
    .rna-article-header h1 { font-size: clamp(34px, 9vw, 46px); }
    .rna-lead { font-size: 18px; }
    .rna-search-row { flex-direction: column; }
    .rna-search button { width: 100%; }
    .rna-section { margin-top: 42px; }
    .rna-section-heading { margin-bottom: 17px; }
    .rna-card-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .rna-card-body { padding: 20px; }
    .rna-card h2 { font-size: 21px; }
    .rna-category-panel { margin-top: 45px; padding: 22px 15px; }
    .rna-nav-panel { padding-top: 15px; }
    .rna-article-header { margin-bottom: 30px; }
    .rna-article-layout { grid-template-columns: minmax(0, 1fr); gap: 25px; }
    .rna-entry { font-size: 17px; line-height: 1.72; }
    .rna-reading-note { position: static; }
    .rna-entry table { font-size: 14px; }
    .rna-footer { padding-block: 30px; }
  }

  @media (max-width: 390px) {
    .rna-container { width: calc(100% - 28px); }
    .rna-nav { column-gap: 3px; }
    .rna-nav a { padding-inline: 9px; font-size: 12px; }
    .rna-brand { gap: 10px; }
    .rna-brand-name { font-size: 19px; }
    .rna-category-panel { padding-inline: 12px; }
  }

  @media (prefers-reduced-motion: reduce) {
    .rna-site *, .rna-site *::before, .rna-site *::after { transition-duration: .01ms !important; }
  }
}