/* ============================================================
   Stamp Paper Formatter - Premium Light UI
   Accent: indigo-violet (hue 285). This stylesheet is shared by
   ~38 pSEO subpages, so the class vocabulary is RESTYLED, never
   renamed, and every legacy custom-property name the subpages
   consume is aliased to the new OKLCH tokens.
   ============================================================ */
:root {
    /* Premium light design tokens */
    --ink: oklch(24% .02 285);
    --muted: oklch(52% .03 285);
    --paper: oklch(97% .008 285);
    --surface: oklch(100% .002 285);
    --line: oklch(90% .015 285);
    --accent: oklch(52% .17 285);
    --accent-dark: oklch(42% .15 285);
    --accent-soft: oklch(94% .04 285);
    --danger: oklch(55% .19 27);
    --danger-dark: oklch(45% .17 27);
    --danger-soft: oklch(96% .03 27);
    --success: oklch(58% .14 150);
    --success-dark: oklch(46% .13 150);
    --success-soft: oklch(95% .05 150);

    --radius: 16px;
    --shadow-sm: 0 1px 2px oklch(24% .02 285 / .06), 0 4px 14px oklch(24% .02 285 / .05);
    --shadow-md: 0 10px 30px oklch(24% .02 285 / .10);

    /* Legacy-compat aliases consumed by shared/inheriting subpages */
    --bg: var(--paper);
    --bg2: var(--surface);
    --bg-panel: var(--surface);
    --border: var(--line);
    --text: var(--ink);
    --heading: var(--ink);
    --primary: var(--accent-dark);
    --accent-hover: var(--accent-dark);
    --accent2: var(--accent);
    --header-bg: var(--surface);
    --section-alt-bg: var(--paper);

    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    font-synthesis: none;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: .9em;
}

.muted {
    color: var(--muted);
}

.text-sm {
    font-size: .85rem;
}

.mt-4 {
    margin-top: 1rem;
}

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

/* ===== Header ===== */
.site-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 0 clamp(16px, 5vw, 64px);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo,
.brand {
    font-size: 1.15rem;
    font-weight: 850;
    letter-spacing: -.03em;
    color: var(--ink);
    text-decoration: none;
}

.logo span,
.brand span {
    color: var(--accent);
}

.site-header nav,
nav {
    display: flex;
    gap: 24px;
    font-size: .9rem;
    color: var(--muted);
}

nav a {
    text-decoration: none;
    font-weight: 500;
    transition: color .18s;
}

nav a:hover {
    color: var(--accent-dark);
}

/* ===== Page shell + hero ===== */
.page-wrapper {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 clamp(16px, 5vw, 64px) 64px;
}

.hero {
    padding: clamp(40px, 7vw, 80px) 0 clamp(28px, 4vw, 44px);
    max-width: 820px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-dark);
    background: var(--accent-soft);
    padding: 7px 14px;
    border-radius: 999px;
}

.page-title {
    font-size: clamp(2.2rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -.045em;
    margin: 18px 0 16px;
    text-wrap: balance;
    color: var(--ink);
}

.page-sub {
    max-width: 660px;
    color: var(--muted);
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    line-height: 1.65;
}

/* ===== Tool layout ===== */
.tool-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    margin-bottom: 56px;
}

.sidebar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 88px;
    height: fit-content;
}

.settings-group {
    margin-bottom: 22px;
}

.settings-group h3 {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted);
    margin-bottom: 9px;
    font-weight: 800;
}

.small-label {
    display: block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.help-text {
    font-size: .78rem;
    color: var(--muted);
    line-height: 1.5;
    margin-top: 8px;
}

.state-info-box {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--accent-soft);
    border: 1px solid oklch(86% .05 285);
    color: var(--accent-dark);
    font-size: .82rem;
    line-height: 1.55;
}

.state-info-box strong {
    color: var(--ink);
}

/* ===== Form controls ===== */
.styled-select,
.styled-input {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    font-size: 16px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--paper);
    color: var(--ink);
    transition: border-color .18s, box-shadow .18s;
}

.styled-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6480' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

.styled-select:hover,
.styled-input:hover {
    border-color: oklch(80% .04 285);
}

.styled-select:focus,
.styled-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 750;
    letter-spacing: -.01em;
    transition: transform .18s cubic-bezier(.16, 1, .3, 1), background .18s, color .18s, border-color .18s, box-shadow .18s;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.primary-btn {
    width: 100%;
    background: var(--accent);
    border-color: var(--accent);
    color: oklch(99% .01 285);
    box-shadow: var(--shadow-sm);
}

.primary-btn:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    box-shadow: var(--shadow-md);
}

.primary-btn svg {
    width: 20px;
    height: 20px;
}

.ghost-btn {
    background: var(--paper);
    color: var(--ink);
}

.ghost-btn:hover {
    background: var(--accent-soft);
}

.btn.is-copied {
    background: var(--success-soft);
    border-color: var(--success);
    color: var(--success-dark);
}

.danger-btn {
    color: var(--danger-dark);
    border-color: oklch(85% .06 27);
}

.danger-btn:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.export-actions {
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.privacy-note {
    font-size: .78rem;
    color: var(--muted);
    line-height: 1.5;
}

/* ===== Editor / live paper preview ===== */
.editor-main {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.editor-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 16px;
}

.editor-header h2 {
    font-size: 1.15rem;
    letter-spacing: -.02em;
    color: var(--ink);
}

.doc-stats {
    margin-left: auto;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .01em;
    color: var(--accent-dark);
    background: var(--accent-soft);
    padding: 5px 11px;
    border-radius: 999px;
    white-space: nowrap;
}

.editor-container {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    max-height: 78vh;
    overflow: auto;
}

.paper-ruler {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 700;
    color: var(--muted);
    min-height: 14px;
}

.paper-wrapper {
    /* --paper-w-mm / --paper-h-mm are set at runtime by app.js */
    --paper-w-mm: 216mm;
    --paper-h-mm: 356mm;
    width: fit-content;
    margin: 0 auto;
}

.canvas-paper {
    position: relative;
    width: var(--paper-w-mm);
    height: var(--paper-h-mm);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    box-shadow: 0 12px 34px oklch(24% .02 285 / .16);
    overflow: hidden;
}

.stamp-danger-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    padding: 0 25.4mm;
    background:
        repeating-linear-gradient(-45deg,
            var(--danger-soft) 0, var(--danger-soft) 10px,
            oklch(94% .04 27) 10px, oklch(94% .04 27) 20px);
    border-bottom: 2px dashed var(--danger);
}

.danger-text {
    display: block;
    color: var(--danger-dark);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.5;
}

.danger-text small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--danger);
}

.legal-textarea {
    display: block;
    width: 100%;
    padding: 8mm 25.4mm 0;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: #14110f;
    font-family: "Tinos", "Times New Roman", Georgia, serif;
    font-size: 12pt;
    line-height: 1.5;
}

.legal-textarea::placeholder {
    color: oklch(65% .02 285);
    font-style: italic;
}

/* ===== SEO content ===== */
.seo-section {
    max-width: 820px;
    margin: 8px auto 0;
}

.seo-section h2 {
    font-size: clamp(1.6rem, 3.6vw, 2.4rem);
    line-height: 1.08;
    letter-spacing: -.04em;
    margin: 44px 0 14px;
    text-wrap: balance;
    color: var(--ink);
}

.seo-section h3 {
    font-size: 1.25rem;
    letter-spacing: -.02em;
    margin: 28px 0 10px;
    color: var(--ink);
}

.seo-section p {
    color: var(--muted);
    line-height: 1.75;
    margin-bottom: 14px;
    max-width: 72ch;
}

.seo-section strong {
    color: var(--ink);
}

.step-list {
    max-width: 72ch;
    margin: 4px 0 20px;
    padding-left: 22px;
    color: var(--muted);
    line-height: 1.7;
}

.step-list li {
    margin-bottom: 10px;
}

.step-list li::marker {
    color: var(--accent);
    font-weight: 700;
}

.info-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin: 8px 0 20px;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

.info-table th,
.info-table td {
    text-align: left;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.info-table thead th {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    background: var(--paper);
}

.info-table tbody tr:last-child td {
    border-bottom: none;
}

.info-table tbody tr:hover td {
    background: var(--accent-soft);
}

.faq-item {
    border-top: 1px solid var(--line);
    padding: 18px 0;
}

.faq-q {
    font-weight: 800;
    letter-spacing: -.01em;
    margin-bottom: 8px;
    color: var(--ink);
}

.faq-a {
    color: var(--muted);
    line-height: 1.7;
    font-size: .95rem;
    max-width: 72ch;
}

/* ===== pSEO-injected content sections (inline-styled; kept safe) ===== */
.dt-container {
    max-width: 1240px;
    margin: 0 auto;
    padding-left: clamp(16px, 5vw, 64px);
    padding-right: clamp(16px, 5vw, 64px);
}

.dt-mb-16 {
    margin-bottom: 1rem;
}

/* ===== Footer ===== */
.site-footer {
    margin-top: 40px;
    padding: 28px clamp(16px, 5vw, 64px);
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .82rem;
    text-align: center;
    line-height: 1.7;
}

.site-footer a {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ===== Responsive: single column under 900px ===== */
@media (max-width: 900px) {
    .tool-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .sidebar {
        position: static;
        top: auto;
    }

    .editor-container {
        max-height: none;
        padding: 14px;
    }
}

@media (max-width: 640px) {
    .site-header {
        min-height: 62px;
        gap: 16px;
    }

    .site-header nav,
    nav {
        display: none;
    }

    .hero {
        padding: 40px 0 26px;
    }

    .sidebar,
    .editor-main {
        padding: 18px;
        border-radius: 15px;
    }

    /* 16px inputs prevent iOS auto-zoom on focus */
    .styled-select,
    .styled-input,
    .btn {
        font-size: 16px;
    }

    .grid-2,
    .action-grid {
        grid-template-columns: 1fr;
    }

    .paper-ruler {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ===== Reduced motion (must close the stylesheet) ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
