/*
 * 디자인 기준: 한국의 도로명판과 건물번호판.
 * 파란 판, 흰 안쪽 테두리, 한글과 로마자를 함께 적는 방식을 화면 요소로 쓴다.
 * 판 모양은 검색칸(.plate)과 건물번호판(.number-plate) 두 곳에만 쓴다. 나머지는 조용하게 둔다.
 */
:root {
    --sign: #1b4b9c;
    --sign-deep: #143a7a;
    --ink: #101b33;
    --muted: #566079;
    --paper: #f1f4f9;
    --card: #ffffff;
    --line: #d5dbe6;
    --amber: #f2b705;

    --display: "Do Hyeon", "Gothic A1", sans-serif;
    --body: "Gothic A1", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

    --radius: 14px;
    --radius-small: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--paper);
    word-break: keep-all;
    overflow-wrap: break-word;
}

a { color: var(--sign); text-underline-offset: 3px; }
a:hover { color: var(--sign-deep); }

button { font-family: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible {
    outline: 3px solid var(--amber);
    outline-offset: 2px;
}

h1, h2, h3 { line-height: 1.3; margin: 0; }
h1 { text-wrap: balance; }
h1 { font-family: var(--display); font-size: 34px; font-weight: 400; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }

.site-header, main, .site-footer {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- 머리말, 바닥글 ---------- */

.site-header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    align-items: center;
    justify-content: space-between;
    padding-top: 18px;
    padding-bottom: 18px;
}
.brand {
    padding: 5px 14px 3px;
    font-family: var(--display);
    font-size: 19px;
    color: #fff;
    text-decoration: none;
    background: var(--sign);
    border-radius: 7px;
    box-shadow: inset 0 0 0 2px var(--sign), inset 0 0 0 3.5px rgba(255, 255, 255, 0.85);
}
.brand:hover { color: #fff; background: var(--sign-deep); }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 15px; font-weight: 500; }
.site-header nav a { color: var(--ink); text-decoration: none; }
.site-header nav a:hover { color: var(--sign); text-decoration: underline; }

main { padding-bottom: 56px; }
main > section, main > article > section { margin-top: 40px; }
main > section:first-child { margin-top: 8px; }

.site-footer {
    padding-top: 28px;
    padding-bottom: 40px;
    color: var(--muted);
    font-size: 14px;
    border-top: 1px solid var(--line);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 14px; }
.site-footer nav a { color: var(--muted); }

/* ---------- 도로명판 모양 검색칸 ---------- */

.plate {
    position: relative;
    padding: 36px 36px 30px;
    color: #fff;
    background: var(--sign);
    border-radius: 22px;
    box-shadow: 0 14px 30px -18px rgba(20, 58, 122, 0.7);
}
/* 실제 도로명판의 흰 안쪽 테두리 */
.plate::before {
    content: "";
    position: absolute;
    inset: 9px;
    border: 2.5px solid rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    pointer-events: none;
}
.plate h1 { font-size: 46px; color: #fff; }
.plate .roman { margin-top: 2px; font-size: 17px; font-weight: 500; letter-spacing: 0.02em; opacity: 0.85; }
.plate .lead { margin-top: 14px; max-width: 34em; opacity: 0.92; }
.plate.compact { padding: 26px 28px 24px; }

.search { display: grid; gap: 10px; margin-top: 22px; }
.plate.compact .search { margin-top: 0; }
.search-main { position: relative; display: flex; gap: 10px; }
.search input[type="search"], .search input[type="text"] {
    width: 100%;
    min-width: 0;
    padding: 14px 16px;
    font: inherit;
    color: var(--ink);
    background: #fff;
    border: 0;
    border-radius: var(--radius-small);
}
.search input[type="search"] { font-size: 18px; font-weight: 500; }
.search input[type="text"] { background: rgba(255, 255, 255, 0.92); }
.search input::placeholder { color: #8791a6; font-weight: 400; }
.search button {
    flex: none;
    padding: 0 26px;
    font-family: var(--display);
    font-size: 20px;
    color: var(--ink);
    background: var(--amber);
    border: 0;
    border-radius: var(--radius-small);
}
.search button:hover { background: #ffc81a; }

/* 자동완성 목록: 검색칸 바로 아래에 겹쳐서 뜬다 */
#suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 5;
    max-height: 360px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
    background: #fff;
    border-radius: var(--radius-small);
    box-shadow: 0 18px 40px -12px rgba(16, 27, 51, 0.45);
}
#suggest a { display: block; padding: 9px 12px; color: var(--ink); text-decoration: none; border-radius: 6px; }
#suggest a:hover, #suggest a:focus { background: var(--paper); }
#suggest strong { display: block; font-weight: 600; }
#suggest span { display: block; color: var(--muted); font-size: 14px; }

/* ---------- 첫 화면 ---------- */

.section-title { margin-bottom: 14px; }

/* 입력 → 결과 예시. 줄마다 변환 결과 화면으로 가는 링크다. */
.pairs { margin: 0; padding: 0; list-style: none; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.pairs li + li { border-top: 1px solid var(--line); }
.pairs a {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 24px minmax(0, 1.25fr);
    gap: 12px;
    align-items: center;
    padding: 15px 20px;
    color: var(--ink);
    text-decoration: none;
}
.pairs a:hover { background: #f8fafd; }
.pairs .kind { font-size: 14px; font-weight: 600; color: var(--sign); }
.pairs .from { font-weight: 600; }
.pairs .arrow { color: var(--muted); text-align: center; }
.pairs .to { color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.tiles a {
    display: block;
    height: 100%;
    padding: 20px 22px;
    color: var(--ink);
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.tiles a:hover { border-color: var(--sign); }
.tiles strong { display: block; font-family: var(--display); font-size: 24px; font-weight: 400; color: var(--sign); }
.tiles span { display: block; margin-top: 4px; color: var(--muted); font-size: 15px; }

/* 자주 묻는 질문: 눌러서 펼친다 */
.faq details { background: var(--card); border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.faq details:last-of-type { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.faq summary {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font-size: 22px; font-weight: 400; line-height: 1; color: var(--sign); }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 20px 18px; max-width: 42em; color: var(--muted); }

/* 글 목록, 고를 주소 목록 */
.results { margin: 0; padding: 0; list-style: none; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.results li + li { border-top: 1px solid var(--line); }
.results a { display: block; padding: 15px 20px; color: var(--ink); text-decoration: none; }
.results a:hover { background: #f8fafd; }
.results strong { display: block; font-weight: 600; }
.results span { display: block; color: var(--muted); font-size: 15px; }

/* ---------- 변환 결과 ---------- */

.page-title { margin: 32px 0 18px; }
.note, .hint { color: var(--muted); font-size: 14px; }
.note + .results { margin-top: 14px; }
.empty { padding: 22px; color: var(--muted); background: var(--card); border-radius: var(--radius); }

.answer {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    padding: 28px;
    background: var(--card);
    border-radius: var(--radius);
}

/* 건물번호판: 위가 뾰족한 오각형 판. 도로명, 번호, 영문 도로명 순서로 적는다. */
.number-plate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    aspect-ratio: 1 / 1.12;
    padding: 0 12px 20px;
    color: #fff;
    text-align: center;
    background: var(--sign);
    clip-path: polygon(50% 0, 100% 26%, 100% 100%, 0 100%, 0 26%);
}
.number-plate .road { font-family: var(--display); font-size: 21px; line-height: 1.2; }
.number-plate .number { font-family: var(--display); font-size: 62px; line-height: 1.05; letter-spacing: -0.01em; }
.number-plate .number.long { font-size: 40px; }
.number-plate .road-en { font-size: 13px; font-weight: 600; line-height: 1.25; opacity: 0.9; }

.answer .english { font-size: 24px; font-weight: 700; line-height: 1.4; }
.answer .actions { margin-top: 14px; }
.answer dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; }
.answer dt { color: var(--muted); }
.answer dd { margin: 0; }

/* 우편번호: 봉투의 다섯 칸 */
.zip { display: inline-flex; gap: 4px; vertical-align: middle; }
.zip span {
    width: 26px;
    padding: 2px 0;
    font-weight: 700;
    text-align: center;
    border: 1.5px solid #c2452f;
    border-radius: 3px;
}

.copy {
    flex: none;
    padding: 7px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sign);
    background: #e8eef9;
    border: 0;
    border-radius: 999px;
}
.copy:hover { color: #fff; background: var(--sign); }
.copy.primary { padding: 10px 20px; font-size: 15px; color: #fff; background: var(--sign); }
.copy.primary:hover { background: var(--sign-deep); }
.copy.done { color: var(--ink); background: var(--amber); }

.panel { padding: 24px 28px; background: var(--card); border-radius: var(--radius); }
.panel > h2 { margin-bottom: 6px; }
.panel > .note { margin-top: 14px; }

.fields { margin: 0; }
.fields > div {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 12px 0;
}
.fields > div + div { border-top: 1px solid var(--line); }
.fields dt { color: var(--muted); font-size: 14px; }
.fields dd { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 0; font-size: 17px; font-weight: 600; }
.fields dd.hint { font-size: 14px; font-weight: 400; }

/* 쇼핑몰 입력란: 실제 입력 칸처럼 그린다 */
.tabs { display: flex; gap: 6px; margin: 14px 0 20px; }
.tabs a, .tabs strong { padding: 7px 18px; font-size: 15px; border-radius: 999px; }
.tabs strong { color: #fff; background: var(--ink); }
.tabs a { color: var(--ink); text-decoration: none; background: var(--paper); }
.tabs a:hover { background: var(--line); }

.shop-form { display: grid; gap: 14px; margin: 0; }
.shop-form dt { margin-bottom: 5px; font-size: 14px; font-weight: 600; }
.shop-form dd {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    margin: 0;
    padding: 6px 8px 6px 14px;
    font-weight: 600;
    background: #fff;
    border: 1.5px solid #aab3c5;
    border-radius: var(--radius-small);
}
.shop-form dd.hint { padding-right: 14px; font-weight: 400; background: var(--paper); border-style: dashed; border-color: var(--line); }

.steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding: 12px 0 12px 44px; counter-increment: step; }
.steps li + li { border-top: 1px solid var(--line); }
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 11px;
    width: 28px;
    height: 28px;
    font-family: var(--display);
    font-size: 17px;
    line-height: 30px;
    color: #fff;
    text-align: center;
    background: var(--sign);
    border-radius: 6px;
}
.steps strong { display: block; }
.steps .hint { display: block; }

.ad-slot { min-height: 280px; margin: 40px 0 0; }
.guide + .ad-slot { max-width: 680px; margin-left: auto; margin-right: auto; }
/* 광고 코드를 넣기 전에는 빈 칸을 접어 둔다. */
.ad-slot:empty { min-height: 0; margin: 0; }

/* ---------- 안내 글 ---------- */

.guide { max-width: 680px; margin: 24px auto 0; }
.guide h1 { font-size: 40px; margin-bottom: 18px; }
.guide h2 { margin: 44px 0 10px; font-size: 22px; }
.guide p, .guide ul { margin: 12px 0; }
.guide ul { padding-left: 22px; }
.guide li + li { margin-top: 8px; }
.guide table { width: 100%; margin: 16px 0; border-collapse: separate; border-spacing: 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-small); }
.guide th, .guide td { padding: 11px 14px; text-align: left; vertical-align: top; }
.guide tr + tr th, .guide tr + tr td { border-top: 1px solid var(--line); }
.guide th:first-child { width: 30%; }
.guide th { font-size: 14px; font-weight: 600; color: var(--muted); background: #f8fafd; }
.guide td { font-weight: 500; }
/* 영문 주소 예시: 판처럼 파란 바탕에 흰 글씨 */
.guide .example { padding: 14px 18px; font-size: 17px; font-weight: 600; color: #fff; background: var(--sign); border-radius: var(--radius-small); }
.guide .note { margin-top: 8px; }

/* ---------- 좁은 화면 ---------- */

@media (max-width: 640px) {
    h1 { font-size: 28px; }
    .plate { padding: 30px 24px 24px; border-radius: 18px; }
    .plate::before { inset: 7px; border-radius: 12px; }
    .plate h1 { font-size: 36px; }
    .plate.compact { padding: 24px 20px 20px; }
    .search-main { flex-direction: column; }
    .search button { padding: 12px; }

    .pairs a { grid-template-columns: 1fr; gap: 2px; }
    .pairs .arrow { display: none; }
    .tiles { grid-template-columns: 1fr; }

    .answer { grid-template-columns: 1fr; padding: 22px; }
    .number-plate { width: 132px; margin: 0 auto; }
    .answer .english { font-size: 20px; }
    .panel { padding: 20px; }
    .fields > div { grid-template-columns: 1fr; gap: 2px; }
    .guide h1 { font-size: 32px; }
    .guide th { width: 40%; }

    /* 손가락으로 누르는 것은 높이 40px 이상으로 맞춘다 */
    .site-header { gap: 4px 24px; padding-bottom: 8px; }
    /* 메뉴는 한 줄로 두고 넘치면 옆으로 민다 */
    .site-header nav { flex-wrap: nowrap; gap: 0 18px; width: 100%; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
    .site-header nav::-webkit-scrollbar { display: none; }
    .site-header nav a { padding: 9px 0; }
    .site-footer nav { flex-direction: column; gap: 0; margin-bottom: 8px; }
    .site-footer a { display: inline-block; padding: 9px 0; }
    .copy { min-height: 40px; padding: 9px 16px; }
    .copy.primary { min-height: 44px; }
}
