/* Happyauto phone readability layer 2026-12-02.
   Loaded last on every page (after ux-20261016.css). Presentation only:
   no content, form, analytics or SEO values live here.
   1) tokens  2) whole-site fixes (overflow, Korean line breaks, contrast)
   3) phone layout (<=767px): type scale, spacing, tables, tap targets. */

/* ---------- 1. Tokens ---------- */
:root {
  /* Accent tuned for text/buttons: #c2410c is 5.18:1 on white, 4.88:1 on #fff7ed. */
  --ui-accent: #c2410c;
  --ui-accent-hover: #9a3412;
  --m-link: #c2410c;
  --m-btn: linear-gradient(135deg, #cc4a0e 0%, #c2410c 100%); /* white text >= 4.6:1 */
  --m-btn-hover: #9a3412;
  --m-ink: #0f172a;
  --m-text: #334155;   /* 10.3:1 on white */
  --m-muted: #475569;  /* 7.6:1 on white, 7.2:1 on #f8fafc */
  --m-line: #e2e8f0;
  --m-on-dark: #cbd5e1; /* 12:1 on #0f172a */
  --m-body: 17px;
  --m-lh: 1.75;
  --m-help: 15px;
  --m-small: 14px;
  --m-h1: clamp(26px, 6.6vw, 32px);
  --m-h2: clamp(21px, 5.4vw, 25px);
  --m-h3: 18px;
  --m-gutter: 16px;
  --m-tap: 44px;
}

.ha-home {
  --ha-primary: #c2410c;
  --ha-primary-hover: #9a3412;
  --ha-primary-gradient: var(--m-btn);
}

/* ---------- 2. Whole site ---------- */
html {
  scroll-padding-top: 76px;
}

body {
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* Codes and numbers in tables stay on one line (the table scrolls instead). */
.comparison-table code {
  white-space: nowrap;
}

/* The article grid had no column track, so a 680px table widened the page. */
.content-shell {
  grid-template-columns: minmax(0, 1fr);
}

.content-shell > * {
  min-width: 0;
}

/* Orange text: #ea580c (3.6:1) -> --m-link. */
.content-shell .content-section a:not(.btn-cta):not(.related-card),
.content-shell .summary-box a:not(.btn-cta),
.content-shell .source-box a,
.content-page .article-meta a,
.content-hero .content-eyebrow,
.ha-home .ha-kicker,
.ha-home .ha-all-cases,
.ha-home .ha-all-cases span,
.ha-home .ha-intent-nav .intent-arrow,
.ha-home .pc-card .pc-facts,
.ha-home .form-field .required,
.ha-home .privacy-note a,
.ha-home .ha-guide-head a,
.ha-home .ha-case figcaption a,
.ha-home .radio-pill input:checked + span,
.ha-home .date-quick-btn.active,
.floating-cta .cta-call {
  color: var(--m-link);
}

.ha-home .ha-kicker {
  color: #ffffff;
}

.ha-home .ha-process span {
  background: var(--m-btn) !important;
  color: #ffffff;
}

.content-hero .breadcrumbs a:hover,
.article-toc a:hover,
.seo-car-links a:hover {
  color: var(--m-btn-hover);
}

/* Orange buttons: white on #ff5c00 was 3.1:1. */
.site-header .header-call,
.ui-btn-quote,
.ha-action,
.ha-home .btn-primary,
.floating-cta .cta-quote,
.article-actions a:first-child,
.content-shell .btn-cta,
.content-shell .btn-primary,
.content-shell .summary-box .btn-cta {
  background: var(--m-btn) !important;
  color: #ffffff !important;
}

.site-header .header-call:hover,
.ui-btn-quote:hover,
.ha-action:hover,
.ha-home .btn-primary:hover,
.floating-cta .cta-quote:hover,
.article-actions a:first-child:hover,
.content-shell .btn-cta:hover {
  background: var(--m-btn-hover) !important;
}

/* The dark page-cta keeps its white button with accent text. */
.content-shell .page-cta .btn-cta {
  background: #ffffff !important;
  color: var(--m-btn-hover) !important;
}

/* Footer legal links: spaced, readable, 44px tall. */
.footer-company,
.ui-footer-company p {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 12px;
}

.footer-company .company-info {
  flex-basis: 100%;
}

.footer-privacy {
  display: inline-flex;
  align-items: center;
  min-height: var(--m-tap);
  padding: 0 8px;
  font-size: 15px !important;
  font-weight: 650;
}

.site-footer .footer-privacy {
  color: var(--m-on-dark) !important;
}

.site-footer.ui-footer .footer-privacy {
  color: var(--m-muted) !important;
}

.ui-footer-company,
.ui-footer-company p {
  font-size: var(--m-small) !important;
  color: var(--m-muted) !important;
  opacity: 1;
}

.ui-footer-nav a {
  font-size: 15px !important;
  color: var(--m-text) !important;
  min-height: var(--m-tap);
}

/* ---------- 3. Phones ---------- */
@media (max-width: 767px) {
  /* Header: one row, <= 64px including its border. */
  .site-header .header-inner,
  .ui-header-inner {
    min-height: 60px;
    padding-block: 6px;
  }

  /* Type scale */
  .content-hero h1,
  .content-page .content-hero h1 {
    font-size: var(--m-h1);
    line-height: 1.3;
    margin: 10px 0 12px;
  }

  .content-hero .content-lead,
  .content-page .content-lead {
    font-size: var(--m-body);
    line-height: var(--m-lh);
    color: var(--m-muted);
  }

  .content-hero .content-eyebrow {
    font-size: var(--m-small);
  }

  .content-shell .content-section h2,
  .seo-guide-section h2 {
    font-size: var(--m-h2);
    line-height: 1.38;
    margin-bottom: 14px;
  }

  .content-shell .content-section h3 {
    font-size: var(--m-h3);
    line-height: 1.45;
    margin: 24px 0 8px;
  }

  .content-shell p,
  .content-shell li,
  .privacy-content p,
  .privacy-content li {
    font-size: var(--m-body);
    line-height: var(--m-lh);
    color: var(--m-text);
  }

  .content-shell .summary-box p {
    font-size: var(--m-body);
    line-height: var(--m-lh);
  }

  .content-shell .factor-card h3,
  .content-shell .related-card strong {
    font-size: 17px;
    line-height: 1.45;
  }

  .content-shell .factor-card p,
  .content-shell .related-card span,
  .content-shell .notice-box,
  .content-shell .source-box,
  .content-shell .notice-box p,
  .content-shell .source-box p,
  .content-shell .source-box li,
  .content-figure figcaption {
    font-size: var(--m-help);
    line-height: 1.7;
    color: var(--m-muted);
  }

  .content-shell .article-meta {
    font-size: var(--m-small);
    color: var(--m-muted);
  }

  /* Spacing: 16px page gutter, one level of boxes only. */
  .content-hero {
    padding-inline: var(--m-gutter);
  }

  .content-shell {
    padding-inline: 12px;
    gap: 16px;
  }

  .content-shell .content-section,
  .seo-guide-section,
  .content-shell .summary-box,
  .content-shell .page-cta {
    padding: 22px 16px;
    border-radius: 14px;
  }

  .content-shell .related-card,
  .content-shell .factor-card,
  .content-shell .notice-box,
  .content-shell .source-box {
    padding: 14px;
    border-radius: 12px;
  }

  .content-shell .content-section > ul > li {
    padding: 12px 14px;
    border-radius: 12px;
  }

  .content-shell .step-list li,
  .content-shell .content-section > ol > li {
    padding: 14px 14px 14px 52px;
    border-radius: 12px;
  }

  .content-shell .step-list li::before,
  .content-shell .content-section > ol > li::before {
    left: 14px;
    top: 16px;
    background: var(--m-btn);
  }

  .content-shell .factor-grid,
  .content-shell .related-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Tables: 2-3 columns stack as labelled rows; wider ones scroll with a hint. */
  .content-shell .comparison-table {
    min-width: 0;
    font-size: var(--m-help);
    line-height: 1.6;
  }

  :is(.table-wrap, .table-scroll):not(:has(tr > :nth-child(4))) {
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: none;
  }

  :is(.table-wrap, .table-scroll):not(:has(tr > :nth-child(4))) :is(table, tbody, tr, th, td) {
    display: block;
    width: auto;
  }

  :is(.table-wrap, .table-scroll):not(:has(tr > :nth-child(4))) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  :is(.table-wrap, .table-scroll):not(:has(tr > :nth-child(4))) tr {
    padding: 14px 0;
    border-top: 1px solid var(--m-line);
  }

  :is(.table-wrap, .table-scroll):not(:has(tr > :nth-child(4))) tr:last-child {
    border-bottom: 1px solid var(--m-line);
  }

  .content-shell :is(.table-wrap, .table-scroll):not(:has(tr > :nth-child(4))) :is(th, td) {
    padding: 0;
    border: 0;
    background: none;
    white-space: normal;
    font-size: var(--m-help);
    line-height: 1.7;
    color: var(--m-text);
  }

  .content-shell :is(.table-wrap, .table-scroll):not(:has(tr > :nth-child(4))) tbody th {
    font-size: 17px;
    font-weight: 800;
    color: var(--m-ink);
    margin-bottom: 6px;
  }

  .content-shell :is(.table-wrap, .table-scroll):not(:has(tr > :nth-child(4))) td + td {
    margin-top: 8px;
  }

  :is(.table-wrap, .table-scroll):not(:has(tr > :nth-child(4))) td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: var(--m-small);
    font-weight: 700;
    color: var(--m-muted);
  }

  :is(.table-wrap, .table-scroll):has(tr > :nth-child(4)) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  :is(.table-wrap, .table-scroll):has(tr > :nth-child(4)) table {
    min-width: 560px;
  }

  :is(.table-wrap, .table-scroll):has(tr > :nth-child(4))::before {
    content: "표를 옆으로 밀어 보세요 →";
    position: sticky;
    left: 0;
    display: block;
    width: max-content;
    padding: 8px 12px;
    font-size: var(--m-small);
    font-weight: 650;
    color: var(--m-muted);
  }

  /* Tap targets */
  .breadcrumbs a,
  .content-hero .breadcrumbs a {
    display: inline-flex;
    align-items: center;
    min-height: var(--m-tap);
    padding-inline: 4px;
  }

  .breadcrumbs a {
    min-width: var(--m-tap);
    justify-content: center;
  }

  .content-hero .breadcrumbs {
    font-size: var(--m-small);
    margin-bottom: 4px;
    gap: 2px;
  }

  .content-hero .breadcrumbs > span:not([aria-hidden]) {
    padding-inline: 4px;
  }

  .article-meta a {
    display: inline-flex;
    align-items: center;
    min-height: var(--m-tap);
  }

  .content-shell .article-meta {
    padding-block: 4px;
  }

  .statistics-page nav[aria-label="자료 목차"] a {
    display: inline-flex;
    align-items: center;
    min-height: var(--m-tap);
    padding-inline: 6px;
  }

  .article-toc summary {
    display: flex;
    align-items: center;
    min-height: 48px;
    font-size: var(--m-body);
  }

  .article-toc ul {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-toc a {
    display: flex;
    min-height: var(--m-tap);
    font-size: var(--m-help);
    color: var(--m-text);
  }

  .article-actions {
    display: grid;
  }

  .article-actions a {
    min-height: 48px;
    font-size: 16px;
  }

  .content-shell .content-section > a:not(.btn-cta):not(.related-card),
  .privacy-back a {
    display: inline-flex;
    align-items: center;
    min-height: var(--m-tap);
  }

  .seo-car-links a {
    min-height: var(--m-tap);
    font-size: var(--m-help);
  }

  /* Static case page: photos stay whole but no taller than ~half a screen. */
  .content-body figure img {
    width: auto;
    max-height: min(300px, 45vh);
    margin-inline: auto;
    display: block;
  }

  /* Privacy page */
  .privacy-content h2 {
    font-size: var(--m-h2);
    line-height: 1.38;
  }

  /* Home */
  .ha-home .ha-intro {
    font-size: var(--m-body);
    line-height: 1.7;
  }

  .ha-home .ha-intent-nav strong {
    font-size: 16.5px;
  }

  .ha-home .ha-intent-nav small,
  .ha-home .ha-facts .ha-limit,
  .ha-home .ha-model-links span {
    font-size: var(--m-small);
    line-height: 1.65;
    color: var(--m-muted);
  }

  .ha-home .ha-facts p:not(.ha-limit) {
    font-size: 16px;
    line-height: 1.7;
  }

  .ha-home .ha-case {
    padding: 22px 16px;
    border-radius: 16px;
  }

  /* Facts: drop the outer box so the inner cards get the full width. */
  .ha-home .ha-facts {
    padding: 8px 0 0;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .ha-home .ha-facts p:not(.ha-limit) strong + br {
    display: none;
  }

  .ha-home .ha-kicker {
    font-size: var(--m-small);
  }

  .ha-home .ha-process p {
    font-size: 16px;
    color: var(--m-muted);
  }

  .ha-home .ha-case figcaption a,
  .ha-home .ha-guide-head a,
  .ha-home .ha-all-cases {
    display: inline-flex;
    align-items: center;
    min-height: var(--m-tap);
  }

  .calculator-local-badge {
    font-size: 13px;
  }

  .ha-home .ha-facts p:not(.ha-limit),
  .ha-home .ha-intent-nav a {
    padding: 14px;
  }

  .ha-home .pc-card .pc-facts {
    font-size: 13.5px;
  }

  .ha-home .pc-card .pc-description {
    font-size: 15px;
    line-height: 1.7;
  }

  .ha-home .privacy-note {
    font-size: var(--m-small);
    color: var(--m-muted);
  }

  /* The fixed quote button must not cover the last footer line. */
  .ui-footer {
    padding-bottom: calc(104px + env(safe-area-inset-bottom)) !important;
  }
}
