/* Brand colours come from /brand.css (generated from config/site.yaml).
   The values below are only fallbacks. */
:root {
  --primary: #2453d4;
  --primary-dark: #173a9e;
  --accent: #f2a516;
  --text: #16203a;
  --background: #ffffff;
  --surface: #f4f6fb;
  --muted: #5b6478;
  --border: #dde2ee;
  --success: #12805c;
  --error: #b42318;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(22, 32, 58, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.65; color: var(--text); background: var(--background); }
img { max-width: 100%; height: auto; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.6rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--text); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; color: #fff; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 820px; }
.center { text-align: center; }
.lead { font-size: 1.15rem; color: var(--muted); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--border); backdrop-filter: saturate(1.4) blur(8px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.logo { white-space: nowrap; display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.08rem; color: var(--text); text-decoration: none; }
.logo:hover { color: var(--text); }
.logo img { width: 36px; height: 36px; border-radius: 8px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.site-nav a { display: block; padding: 8px 9px; white-space: nowrap; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .93rem; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--surface); color: var(--primary); }
.nav-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; position: relative; }
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after { position: absolute; left: 11px; width: 20px; height: 2px; background: var(--text); content: ""; transition: transform .2s; }
.nav-toggle-bar { top: 21px; }
.nav-toggle-bar::before { left: 0; top: -6px; }
.nav-toggle-bar::after { left: 0; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1279px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); max-height: calc(100vh - 64px); overflow-y: auto; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; padding: 8px 16px 16px; }
  .site-nav a { padding: 12px 10px; font-size: 1rem; }
}

/* Breadcrumbs */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 16px 0; margin: 0 auto; font-size: .88rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border); }
.breadcrumbs a { color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-primary:disabled { background: #a8b3cc; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn-lg { min-height: 52px; padding: 12px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; }
.btn-icon:hover { background: var(--surface); color: var(--error); }

/* Hero + tool grid */
.hero { padding: 48px 0 40px; background: linear-gradient(180deg, var(--surface), var(--background)); text-align: center; }
.hero .lead { max-width: 720px; margin: 0 auto 32px; }
.tool-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; text-align: left; }
.tool-grid-small { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tool-card { display: flex; gap: 14px; align-items: center; height: 100%; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: box-shadow .15s, border-color .15s, transform .15s; }
.tool-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); color: var(--text); }
.tool-icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; font-weight: 800; font-size: .85rem; color: #fff; }
.tool-icon-word { background: #2b579a; }
.tool-icon-pdf { background: #d93025; }
.tool-icon-excel { background: #1e7145; }
.tool-icon-image { background: #b45309; }
.tool-icon-resize { background: #7b3fe4; font-size: 1.3rem; }
.tool-icon-svg { flex: none; display: block; width: 48px; height: 48px; }
.tool-icon-arrow { stroke: var(--primary); }
.tool-card-body { display: flex; flex-direction: column; }
.tool-card-title { font-weight: 700; }
.tool-card-text { font-size: .9rem; color: var(--muted); line-height: 1.4; }

/* Sections */
.section { padding: 56px 0; }
.section-alt { background: var(--surface); }
.section-title { text-align: center; margin-bottom: 32px; }
.how-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.how-steps li { text-align: center; padding: 8px 12px; }
.how-num { display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 12px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 1.2rem; }
.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.features li { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.features p { color: var(--muted); margin: 0; }

/* Tool page */
.tool-hero { padding: 24px 0 40px; background: linear-gradient(180deg, var(--surface), var(--background)); }
.tool-hero h1 { text-align: center; }
.tool-hero .lead { text-align: center; }
.converter { background: #fff; border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 20px; margin-top: 24px; }
.dropzone { margin-bottom: 16px; border: 2px dashed #b9c3da; border-radius: var(--radius); padding: 34px 16px; text-align: center; background: var(--surface); transition: border-color .15s, background .15s; }
.dropzone.dragover { border-color: var(--primary); background: #eaf0ff; }
.dropzone-icon { color: var(--primary); }
.dropzone-title { font-weight: 700; font-size: 1.15rem; margin: 6px 0 0; }
.dropzone-or { color: var(--muted); margin: 4px 0 10px; }
.dropzone-hint { color: var(--muted); font-size: .88rem; margin: 14px 0 0; }
.dropzone:focus-within { border-color: var(--primary); outline: 3px solid var(--accent); outline-offset: 2px; }
.selected-file { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.file-badge { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; font-size: .78rem; }
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--muted); font-size: .9rem; }
.options { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 6px; margin: 0 0 16px; }
.options legend { font-weight: 700; padding: 0 6px; }
.option-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 10px; }
.option-row > label:first-child, .option-label { font-weight: 500; }
.option-row select, .option-row input[type="number"] { min-height: 44px; min-width: 220px; padding: 8px 10px; border: 1px solid #b9c3da; border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
.option-help { color: var(--muted); font-size: .9rem; }
.checkbox { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.checkbox input { width: 20px; height: 20px; }
.segmented { display: inline-flex; max-width: 100%; border: 1px solid #b9c3da; border-radius: 8px; overflow: hidden; }
.segmented label { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; cursor: pointer; }
.segmented label + label { border-left: 1px solid #b9c3da; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 0; font-size: .88rem; color: var(--muted); text-align: center; }
.status, .result { text-align: center; padding: 26px 8px; }
.status-text { font-weight: 600; margin: 12px 0; }
.spinner { width: 46px; height: 46px; margin: 0 auto; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } * { transition: none !important; } }
.progress { height: 8px; max-width: 420px; margin: 0 auto; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar { width: 0; height: 100%; background: var(--primary); transition: width .2s; }
.result-icon { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: #e3f6ee; color: var(--success); font-size: 1.8rem; font-weight: 700; }
.result-title { margin: 12px 0 4px; }
.result-title:focus { outline: none; }
.result-file { color: var(--muted); word-break: break-word; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.result-note { color: var(--muted); font-size: .88rem; margin-top: 14px; }
.alert { border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.alert-error { background: #fdecea; color: var(--error); border: 1px solid #f5c2bd; text-align: center; }
.alert-error p { margin-bottom: 10px; font-weight: 500; }

/* Content */
.content { padding-top: 40px; padding-bottom: 48px; }
.content section { margin-bottom: 40px; }
.content ul, .content ol { padding-left: 1.3em; }
.content li { margin-bottom: .4em; }
.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li { counter-increment: step; position: relative; padding: 4px 0 4px 48px; margin-bottom: 14px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); color: var(--primary); font-weight: 700; }
.feature-list { list-style: none; padding: 0 !important; }
.feature-list li { padding: 12px 16px; border-left: 4px solid var(--primary); background: var(--surface); border-radius: 0 10px 10px 0; margin-bottom: 10px; }
.callout { background: #fff8e8; border: 1px solid #f6dfa5; border-radius: var(--radius); padding: 20px 22px 8px; }
.faq details { border: 1px solid var(--border); border-radius: 12px; background: #fff; margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 16px 44px 16px 18px; font-weight: 600; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 12px; font-size: 1.4rem; color: var(--primary); }
.faq details[open] summary::after { content: "−"; }
.faq-answer { padding: 0 18px 6px; color: #333c52; }
.page { padding-top: 32px; }
.legal h2 { margin-top: 1.6em; }
.meta { color: var(--muted); font-size: .92rem; }
.contact-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; text-align: center; margin: 24px 0; }
.contact-email { font-size: 1.3rem; font-weight: 700; word-break: break-all; }

/* Ads (reserved space prevents layout shift) */
.ad-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100px; margin: 24px auto; max-width: 1160px; padding: 0 16px; }
.ad-slot.ad-result { min-height: 90px; margin: 18px auto 0; padding: 0; }
.ad-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.ad-placeholder { background: repeating-linear-gradient(45deg, #f1f3f8, #f1f3f8 10px, #e8ebf3 10px, #e8ebf3 20px); border: 1px dashed #c3cadb; border-radius: 10px; color: var(--muted); font-size: .85rem; width: calc(100% - 32px); }

/* Footer */
.site-footer { background: #0f1629; color: #c9d1e4; padding: 48px 0 24px; margin-top: 24px; }
.site-footer a { color: #e3e8f4; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-title { font-size: .95rem; color: #fff; text-transform: uppercase; letter-spacing: .06em; }
.logo-footer { color: #fff; margin-bottom: 12px; }
.logo-footer:hover { color: #fff; }
.social { display: flex; flex-wrap: wrap; gap: 12px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; border-top: 1px solid #263150; margin-top: 32px; padding-top: 20px; font-size: .88rem; }
.footer-bottom p { margin: 0; }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }
@media (max-width: 520px) {
  body { font-size: 1rem; }
  .converter { padding: 14px; border-radius: 16px; }
  .option-row select, .option-row input[type="number"] { min-width: 0; width: 100%; }
  .option-row { flex-direction: column; align-items: stretch; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
  .logo span { font-size: .98rem; }
}

/* Blog */
.blog-hero { padding: 36px 0 28px; background: linear-gradient(180deg, var(--surface), var(--background)); text-align: center; }
.blog-hero .lead { max-width: 760px; margin: 0 auto; }
.blog-page-no { color: var(--muted); font-weight: 600; font-size: .6em; }
.blog-list { padding-bottom: 48px; }
.post-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.post-card { min-width: 0; }
.post-card article { display: flex; flex-direction: column; height: 100%; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.post-card article:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.post-card-media { display: block; aspect-ratio: 1200 / 630; background: var(--surface); }
.post-card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.post-card-body { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; }
.post-category { margin: 0 0 6px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }
.post-card-title { font-size: 1.15rem; margin: 0 0 8px; }
.post-card-title a { color: var(--text); text-decoration: none; }
.post-card-title a:hover { color: var(--primary); text-decoration: underline; }
.post-card-excerpt { color: var(--muted); font-size: .95rem; line-height: 1.55; margin: 0 0 12px; }
.post-card-meta { margin: auto 0 10px; color: var(--muted); font-size: .85rem; }
.post-card-link { font-weight: 600; text-decoration: none; }
.post-card-link:hover { text-decoration: underline; }
.pagination ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 32px 0 0; padding: 0; }
.pagination a, .pagination span[aria-current] { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 44px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; font-weight: 600; }
.pagination span[aria-current] { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination a:hover { background: var(--surface); }
.blog-empty { text-align: center; padding: 16px 0; }

.post { padding-top: 24px; padding-bottom: 16px; }
.post-header h1 { margin-bottom: 12px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--muted); font-size: .92rem; margin: 0 0 22px; }
.post-image { margin: 0 0 28px; }
.post-image img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.prose { font-size: 1.0625rem; overflow-wrap: break-word; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.5em; font-size: 1.15rem; }
.prose h4 { margin-top: 1.3em; font-size: 1.02rem; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.prose li { margin-bottom: .45em; }
.prose li > p { margin-bottom: .4em; }
.prose img { display: block; margin: 1.2em auto; border-radius: 10px; }
.prose blockquote { margin: 1.2em 0; padding: 12px 18px; border-left: 4px solid var(--primary); background: var(--surface); border-radius: 0 10px 10px 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-size: .9em; background: var(--surface); padding: 1px 6px; border-radius: 6px; }
.prose pre { overflow-x: auto; background: #0f1629; color: #e3e8f4; padding: 14px 16px; border-radius: 10px; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: 10px; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.prose th, .prose td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose thead th { background: var(--surface); font-weight: 700; }
.prose tbody tr:last-child td { border-bottom: 0; }
.post-tool { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px 18px; margin: 32px 0 24px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.post-tool-title { font-size: 1.1rem; margin: 0 0 4px; }
.post-tool p { margin: 0; color: var(--muted); font-size: .95rem; }
.post-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0; }
.post-tags li { padding: 4px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: .85rem; color: var(--muted); }
.related-posts { padding-top: 24px; }
.related-posts > h2 { text-align: center; margin-bottom: 20px; }
.related-posts .post-card-title { font-size: 1.05rem; }
.post-back { margin-top: 28px; margin-bottom: 40px; }
.preview-banner { margin: 18px 0 0; padding: 12px 16px; border-radius: 10px; background: #fff8e8; border: 1px solid #f6dfa5; }
.guide-list { list-style: none; padding: 0 !important; }
.guide-list li { padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.guide-list a { font-weight: 600; }
.guide-excerpt { display: block; color: var(--muted); font-size: .92rem; line-height: 1.5; margin-top: 2px; }
@media (max-width: 640px) {
  .post-tool { grid-template-columns: auto minmax(0, 1fr); }
  .post-tool .btn { grid-column: 1 / -1; }
}

/* Analytics consent (only rendered when GA_MEASUREMENT_ID is set) */
.consent-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -8px 30px rgba(22, 32, 58, .12); padding: 16px 0; }
.consent-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.consent-text { flex: 1 1 420px; min-width: 0; }
.consent-title { font-size: 1.05rem; margin: 0 0 4px; }
.consent-title:focus { outline: none; }
.consent-text p { margin: 0; font-size: .95rem; color: var(--text); }
.consent-status { margin-top: 6px !important; font-weight: 600; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-consent { background: var(--primary); color: #fff; min-width: 170px; }
.btn-consent:hover { background: var(--primary-dark); color: #fff; }
#analytics { scroll-margin-top: 84px; }
.consent-link { border: 0; background: none; padding: 0; font: inherit; color: #e3e8f4; text-decoration: underline; cursor: pointer; }
.consent-link:hover { color: #fff; }
@media (max-width: 520px) {
  .consent-banner { padding: 12px 0; }
  .consent-text p { font-size: .9rem; }
  .consent-actions { width: 100%; }
  .btn-consent { flex: 1 1 0; min-width: 0; padding: 10px 8px; }
}
