/* gaesangi.com — one column, large type, high contrast. Text ≥ 4.5:1, borders and controls ≥ 3:1. */
:root {
  --ink: #14171c;
  --muted: #434a55;
  --line: #d3d8df;
  --field: #5f6672;
  --surface: #f4f6f9;
  --accent: #0b4ea2;
  --accent-dark: #083a7a;
  --accent-soft: #e8effa;
  --warn: #8a4500;
  --warn-line: #c46a00;
  --warn-soft: #fff5e6;
  --error: #a3221b;
  --error-soft: #fdf0ef;
  --focus: #ffbf1f;
  color-scheme: light;
  font-family: Pretendard, "Pretendard Variable", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  font-size: 118.75%;
  line-height: 1.6;
  color: var(--ink);
  background: #fff;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (min-width: 640px) { :root { font-size: 125%; } }

* { box-sizing: border-box; }
body { margin: 0; background: #fff; word-break: keep-all; overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.3; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 0.8rem; }
ul, ol { margin: 0 0 0.8rem; padding-left: 1.3rem; }
li + li { margin-top: 0.4rem; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent-dark); text-decoration-thickness: 2px; }
strong { font-weight: 700; }
@media (min-width: 640px) { h1 { font-size: 1.9rem; } }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus); }
a:focus-visible { background: var(--focus); color: var(--ink); box-shadow: none; outline-offset: 0; }

.skip { position: absolute; left: 1rem; top: -10rem; z-index: 10; padding: 0.6rem 1rem; background: var(--focus); color: var(--ink); font-weight: 700; }
.skip:focus { top: 0.5rem; }
.wrap { width: 100%; max-width: 46rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .wrap { padding: 0 1.5rem; } }
[hidden] { display: none !important; }

/* Header: the wordmark is the only brand element. */
.site-header { border-bottom: 2px solid var(--ink); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.6rem; }
.wordmark { font-family: Pretendard, "Helvetica Neue", Arial, sans-serif; color: var(--ink); text-decoration: none; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; padding: 0.4rem 0; }
.wordmark span { color: var(--accent); font-weight: 700; }
.wordmark:hover { color: var(--ink); }
.site-header nav { display: flex; gap: 1rem; font-size: 0.9rem; }
.site-header nav a { color: var(--ink); padding: 0.5rem 0; }

main.wrap { padding-top: 1.6rem; padding-bottom: 3rem; }
.lede { font-size: 1.05rem; margin: 0.8rem 0 0; }
.muted, .hint { color: var(--muted); }
.hint { display: block; font-size: 0.9rem; margin-top: 0.4rem; }
.small { font-size: 0.9rem; }

/* Home */
.tool-list { list-style: none; padding: 0; margin: 1.6rem 0 0; border-top: 1px solid var(--line); }
.tool-list li { margin: 0; border-bottom: 1px solid var(--line); }
.tool-list a { display: block; padding: 1.2rem 0; color: var(--ink); text-decoration: none; }
.tool-list a:hover :is(h2, h3) { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.tool-list h2, .tool-list h3 { color: var(--accent); font-size: 1.25rem; }
.tool-list p { margin: 0.4rem 0 0; color: var(--muted); }
.tool-list .go { display: inline-block; margin-top: 0.8rem; padding: 0.7rem 1.2rem; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 700; }
.tool-list a:hover .go { background: var(--accent-dark); }
.home-notes { margin-top: 2rem; }
.list-title { margin-top: 2.4rem; font-size: 1.1rem; color: var(--muted); }
.guide-list { margin-top: 0.6rem; }
.guide-list h3 { font-size: 1.1rem; }

/* Calculator: the rates decide the result, so they sit above the form. */
.rates { display: grid; grid-template-columns: 1fr 1fr; margin: 1.2rem 0 0; border: 1px solid var(--line); border-radius: 6px; }
.rates div { padding: 0.8rem 1rem; }
.rates div + div { border-left: 1px solid var(--line); }
.rates dt { font-size: 0.9rem; color: var(--muted); }
.rates dd { margin: 0.1rem 0 0; font-size: 1.3rem; font-weight: 800; }

.step { margin-top: 2rem; padding-top: 1.6rem; border-top: 2px solid var(--ink); }
.step > h2 { margin-bottom: 1rem; }
.step > h3 { margin: 1.6rem 0 0.4rem; }

/* What the tool does end to end: calculation, then the certified-mail document, then sending it. */
.flow { display: grid; gap: 0.2rem; list-style: none; padding: 0; margin: 1rem 0 0; counter-reset: flow; font-weight: 700; }
.flow li { margin: 0; counter-increment: flow; }
.flow li::before { content: counter(flow) ". "; color: var(--accent); }
@media (min-width: 640px) {
  .flow { display: flex; gap: 0; }
  .flow li:not(:last-child)::after { content: "→"; margin: 0 0.6rem; color: var(--muted); font-weight: 400; }
}

.steps { padding-left: 1.4rem; }
.steps li + li { margin-top: 0.8rem; }
.next-step { display: block; margin-top: 1rem; padding: 0.8rem 1rem; border: 2px solid var(--accent); border-radius: 6px; font-weight: 700; text-decoration: none; text-align: center; }
.next-step:hover { background: var(--accent-soft); }

/* Guides */
.crumbs { margin-bottom: 0.8rem; font-size: 0.9rem; color: var(--muted); }
.crumbs a { color: inherit; }
.toc { margin-top: 1.2rem; padding: 0.8rem 1rem; background: var(--surface); border-radius: 6px; }
.toc p { margin: 0 0 0.3rem; font-weight: 700; }
.toc ol { margin: 0; }
.article h3 { margin: 1.2rem 0 0.4rem; }
.compare th, .compare td { white-space: normal; text-align: left; width: 50%; }
.checklist { list-style: none; padding: 0; }
.checklist li { position: relative; padding-left: 1.8rem; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 0.25em; width: 1.1rem; height: 1.1rem; border: 2px solid var(--field); border-radius: 3px; }
.facts { margin: 0; border-top: 1px solid var(--line); }
.facts div { display: grid; gap: 0.2rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
@media (min-width: 640px) { .facts div { grid-template-columns: 5rem 1fr; gap: 1rem; } }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
.say { padding: 0.8rem 1rem; border-radius: 6px; background: var(--accent-soft); font-weight: 700; font-size: 1.1rem; }
.sample { padding: 1.2rem; border: 1px solid var(--field); border-radius: 4px; font-family: "Nanum Myeongjo", AppleMyungjo, Batang, serif; font-size: 0.95rem; line-height: 1.8; }
.sample-title { text-align: center; font-weight: 700; font-size: 1.1rem; }
.sample-sign { text-align: right; }
.envelope { display: grid; gap: 1.6rem; margin: 1rem 0; padding: 1rem; border: 2px solid var(--field); border-radius: 4px; font-size: 0.9rem; line-height: 1.5; }
@media (min-width: 640px) { .envelope { aspect-ratio: 22 / 11; } }
.envelope p { margin: 0; }
.envelope .to { justify-self: end; align-self: end; max-width: 100%; min-width: 0; }
.envelope span { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.cta { margin-top: 2rem; padding: 1rem; border-radius: 6px; background: var(--accent-soft); }
.cta p { margin-bottom: 0; font-weight: 700; }
.link-list { padding-left: 1.2rem; }

/* Reserved ad positions (labour attorneys, lawyers, legal platforms). Hidden until filled; labelled 광고 as Korean ad law requires. */
.ad-slot { margin-top: 2rem; padding: 0.6rem 1rem 1rem; border: 1px solid var(--line); border-radius: 6px; min-height: 7rem; }
.ad-slot::before { content: "광고"; display: block; margin-bottom: 0.4rem; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.ad-placeholder { display: grid; place-items: center; min-height: 5rem; margin: 0; border: 1px dashed var(--field); border-radius: 4px; color: var(--muted); }

/* Transient action feedback; also the live region announced by screen readers. */
.toast { position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 20; width: max-content; max-width: calc(100% - 2rem); padding: 0.8rem 1.2rem; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 700; text-align: center; box-shadow: 0 6px 20px rgb(0 0 0 / 0.25); transform: translate(-50%, 0); opacity: 0; pointer-events: none; }
.toast.show { opacity: 1; }
.toast:empty { display: none; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; margin-bottom: 0.5rem; }
.field { margin-top: 1.2rem; min-width: 0; }
.field > label { display: block; font-weight: 700; margin-bottom: 0.4rem; }
.optional { font-weight: 400; color: var(--muted); }

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; min-height: 3rem; padding: 0.55rem 0.8rem; border: 2px solid var(--field); border-radius: 6px; background: #fff; }
select { appearance: none; padding-right: 2.6rem; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: right 1.3rem center, right 0.95rem center; background-size: 0.4rem 0.4rem; background-repeat: no-repeat; }
/* Date inputs: full width like every other field. iOS Safari otherwise sizes them to their content
   (shorter, or overflowing with long locale formats) and collapses the empty value's height. */
input[type=date] { display: block; width: 100%; max-width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; min-height: 1.6em; }
input[type=date]::-webkit-calendar-picker-indicator { margin-left: auto; }
textarea { min-height: 7rem; }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--error); border-width: 3px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--ink); outline-offset: 0; }

.money { display: flex; align-items: stretch; max-width: 22rem; }
.money input { border-radius: 6px 0 0 6px; text-align: right; font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.money span { display: flex; align-items: center; padding: 0 0.9rem; border: 2px solid var(--field); border-left: 0; border-radius: 0 6px 6px 0; background: var(--surface); font-weight: 700; white-space: nowrap; }
.money-read { font-weight: 700; color: var(--accent); min-height: 1.6em; }
/* Same field with a short unit such as %. */
.with-unit { max-width: 12rem; }

.choices { display: grid; gap: 0.6rem; }
@media (min-width: 480px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice, .check { display: flex; align-items: center; gap: 0.7rem; cursor: pointer; }
.choice { min-height: 3.4rem; padding: 0.6rem 0.9rem; border: 2px solid var(--field); border-radius: 6px; font-weight: 700; }
.choice:has(:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
input[type=radio], input[type=checkbox] { flex-shrink: 0; width: 1.4rem; height: 1.4rem; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
.check { align-items: flex-start; margin-top: 1.2rem; }
.check input { margin-top: 0.15rem; }

.installment { margin-top: 1rem; padding: 0.4rem 1rem 1.2rem; border: 2px solid var(--line); border-radius: 6px; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.6rem; }
.row-title { font-weight: 800; font-size: 1.05rem; }

button { min-height: 3rem; padding: 0.55rem 1.1rem; border: 2px solid var(--accent); border-radius: 6px; background: #fff; color: var(--accent); font-weight: 700; cursor: pointer; }
button:hover { background: var(--accent-soft); }
button:disabled { border-color: var(--line); color: var(--muted); background: #fff; cursor: not-allowed; }
button.primary { width: 100%; min-height: 3.4rem; background: var(--accent); color: #fff; font-size: 1.1rem; }
button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.text { min-height: 2.6rem; padding: 0.3rem 0.2rem; border: 0; background: none; text-decoration: underline; text-underline-offset: 0.2em; }
button.text:hover { text-decoration-thickness: 2px; background: none; }
.add-row { width: 100%; margin-top: 1rem; border-style: dashed; }
.actions { display: grid; gap: 0.6rem; justify-items: center; margin-top: 1.6rem; }
.privacy { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--muted); text-align: center; }

details { margin-top: 1rem; border: 1px solid var(--line); border-radius: 6px; }
summary { min-height: 3rem; padding: 0.7rem 1rem; font-weight: 700; cursor: pointer; }
summary:hover { color: var(--accent); }
details > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
details > :last-child { margin-bottom: 1rem; }
details[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 0.8rem; }

.notice { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 6px; background: var(--warn-soft); }
.notice strong:first-child { display: block; color: var(--warn); }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.error { margin-top: 1rem; padding: 0.8rem 1rem; border: 3px solid var(--error); border-radius: 6px; background: var(--error-soft); }
.error p { margin-bottom: 0.4rem; color: var(--error); }
.error ul { margin: 0; }
.error a { color: var(--ink); font-weight: 700; }
.status-note { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 6px; background: var(--warn-soft); font-weight: 700; }

/* Result: the total is the answer, so it is the largest number on the page. */
.result { margin-top: 2rem; padding: 1.2rem 1rem; border: 3px solid var(--accent); border-radius: 8px; }
@media (min-width: 640px) { .result { padding: 1.6rem; } }
.result h2 { font-size: 1.1rem; color: var(--muted); font-weight: 700; }
.total { margin: 0.2rem 0 1rem; font-size: 2.2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; font-variant-numeric: tabular-nums; }
@media (min-width: 640px) { .total { font-size: 2.6rem; } }
.summary { margin: 0; border-top: 1px solid var(--line); }
.summary div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
#result-context { margin-top: 1rem; }
.result .primary { margin-top: 1.2rem; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; padding-bottom: 0.4rem; color: var(--muted); }
th, td { padding: 0.5rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { border-bottom: 2px solid var(--ink); }

.doc-actions { display: grid; gap: 0.6rem; margin-top: 1rem; }
@media (min-width: 640px) { .doc-actions { grid-template-columns: 2fr 1fr; } }
.document { margin-top: 1.2rem; padding: 1.2rem; border: 1px solid var(--field); font-family: "Nanum Myeongjo", AppleMyungjo, Batang, serif; font-size: 16px; line-height: 1.9; color: #111; }
@media (min-width: 640px) { .document { padding: 2rem; } }
.document h2 { text-align: center; font-size: 22px; margin-bottom: 1.2em; }
.document p { white-space: pre-wrap; }
.document table { font-size: 14px; table-layout: fixed; }
.document th, .document td { white-space: normal; text-align: left; padding: 0.3rem; vertical-align: top; }
.reset-row { margin-top: 2rem; text-align: center; }

/* Reference content below the tool */
.reference h2 { margin-bottom: 0.8rem; }
.formula { padding: 0.8rem 1rem; background: var(--surface); border-radius: 6px; font-weight: 700; }
.sources { list-style: none; padding: 0; }

.site-footer { border-top: 2px solid var(--ink); padding: 1.6rem 0 2.4rem; font-size: 0.9rem; color: var(--muted); }
.site-footer p { margin-bottom: 0.4rem; }
.site-footer .wordmark { font-size: 1.1rem; display: inline-block; margin-bottom: 0.4rem; }
.site-footer a[href^="tel"] { font-weight: 700; }

.only-print { display: none; }
.noscript { padding: 0.8rem 1rem; border-radius: 6px; background: var(--warn-soft); }

@media (max-width: 400px) {
  .rates { grid-template-columns: 1fr; }
  .rates div + div { border-left: 0; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .toast { transform: translate(-50%, 0.6rem); transition: opacity 0.2s, transform 0.2s; }
  .toast.show { transform: translate(-50%, 0); }
}
@media print {
  body { font-size: 11pt; }
  .site-header, main, .site-footer, .skip, .toast { display: none !important; }
  .only-print { display: block; }
  .document { border: 0; margin: 0; padding: 0; font-size: 11pt; }
  .document h2 { font-size: 18pt; }
  .document table { table-layout: fixed; width: 100%; font-size: 9pt; }
  .document th, .document td { white-space: normal; overflow-wrap: anywhere; padding: 7px 5px; }
  .document p { orphans: 3; widows: 3; }
  tr { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  @page { size: A4; margin: 20mm; }
}
