/* Fonts are served from vendor/fonts (no Google Fonts request). Licenses: vendor/licenses/*_OFL.txt */
@font-face {
  font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url("vendor/fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url("vendor/fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/instrument-serif-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/instrument-serif-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --ink: #262126;
  --muted: #625a5f;
  --line: #e2d8c8;
  --paper: #fffdf7;
  --page: #f7f2e8;
  --wine: #5b304a;
  --wine-dark: #412236;
  --wine-soft: #f3e7ec;
  --honey: #e8a93a;
  --honey-soft: #fbf0d9;
  --error: #a3352b;
  --display: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-family: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--page); line-height: 1.6; }
a { color: var(--wine); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- top bar & footer ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px); background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.topbar nav { display: flex; gap: clamp(12px, 3vw, 26px); }
.topbar nav a { font-size: .92rem; font-weight: 600; text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; }

.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  max-width: 960px; margin: 0 auto; padding: 20px 16px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }

main { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ---------- hero ---------- */
.hero { padding: clamp(36px, 7vw, 72px) 0 clamp(24px, 4vw, 40px); }
.hero-tool { padding-bottom: 22px; }
.kicker { margin: 0 0 10px; color: var(--wine); font-size: .76rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0 0 14px; font: 400 clamp(40px, 6.4vw, 72px) / 1.02 var(--display); letter-spacing: -.01em; }
h1 em { color: var(--wine); }
.lede { max-width: 62ch; margin: 0; color: var(--muted); font-size: 1.06rem; }
h2 { margin: 0 0 14px; font: 400 clamp(28px, 3.6vw, 40px) / 1.12 var(--display); }

/* ---------- buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 0; border-radius: 8px; background: var(--wine); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--wine-dark); }
.button:disabled { background: #b9aab3; cursor: default; }
.button.small { min-height: 36px; padding: 0 14px; font-size: .9rem; }
.button.secondary { background: var(--paper); color: var(--wine); box-shadow: inset 0 0 0 1.5px var(--wine); }
.button.secondary:hover { background: var(--wine-soft); }
.button.secondary:disabled { color: #a89aa2; box-shadow: inset 0 0 0 1.5px #cdbfc7; background: var(--paper); }
.button .ext { font-weight: 500; opacity: .85; }
.text-button { padding: 8px 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: .92rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-button:hover { color: var(--ink); }
.icon-button {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--muted); font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.icon-button:hover:not(:disabled) { color: var(--ink); border-color: #c9bca8; }
.icon-button:disabled { opacity: .35; cursor: default; }

/* ---------- converter ---------- */
.converter {
  margin: 0 0 40px; padding: clamp(14px, 3vw, 26px); border: 1px solid var(--line); border-radius: 18px;
  background: var(--paper); box-shadow: 0 14px 36px #49302414;
}
.tabs { display: flex; gap: 4px; margin: 0 0 18px; padding: 4px; border-radius: 12px; background: #f1eadd; overflow-x: auto; }
.tabs [role="tab"] {
  flex: 1 0 auto; min-height: 42px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; white-space: nowrap;
}
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [aria-selected="true"] { background: var(--paper); color: var(--wine); box-shadow: 0 1px 4px #49302422; }

.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 150px; padding: 24px 16px; border: 2px dashed #d5c6ae; border-radius: 14px; background: #fdf9ef;
  text-align: center; cursor: pointer; transition: background .15s, border-color .15s;
}
.drop:hover, .drop.dragging { border-color: var(--honey); background: var(--honey-soft); }
.drop:focus-within { outline: 2px solid var(--wine); outline-offset: 2px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-title {
  display: inline-flex; align-items: center; min-height: 46px; padding: 0 24px; border-radius: 8px;
  background: var(--wine); color: #fff; font-weight: 700; font-size: 1.02rem;
}
.drop-title::before { content: "+"; margin-right: 8px; font-size: 1.3em; font-weight: 400; line-height: 1; }
.drop-hint { color: var(--muted); font-size: .9rem; }

.options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; margin: 18px 0 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-label { color: var(--muted); font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.field-label output { color: var(--ink); text-transform: none; letter-spacing: 0; }
.field select, .field input[type="number"], .field input[type="text"] {
  min-height: 40px; padding: 0 10px; border: 1px solid #d6cab7; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: .95rem;
}
.field select:disabled { opacity: .5; }
.field input[type="number"] { width: 110px; }
.field input[type="text"] { width: 150px; }
.field input[type="range"] { width: 180px; accent-color: var(--wine); }
.field input[type="color"] { width: 64px; height: 40px; padding: 3px; border: 1px solid #d6cab7; border-radius: 8px; background: #fff; }
.inline { display: flex; gap: 8px; }
.segmented { display: flex; flex-wrap: wrap; border: 1px solid #d6cab7; border-radius: 9px; overflow: hidden; background: #fff; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; min-width: 54px; padding: 9px 12px; border-right: 1px solid #ece3d4; text-align: center; font-weight: 700; font-size: .9rem; cursor: pointer; }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--wine); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--honey); outline-offset: -3px; }
.format-note { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .88rem; }
.format-note:empty { display: none; }

.notice { margin: 14px 0 0; font-size: .92rem; }
.notice:empty { display: none; }
.notice.error, .error { color: var(--error); }
.working { color: var(--wine); }

.files { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.files:empty { display: none; }
.file {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 8px 10px 8px 8px; border: 1px solid #ece3d4; border-radius: 12px; background: #fff;
}
.reorder .file { grid-template-columns: auto auto minmax(0, 1fr) auto; cursor: grab; }
.page-number { width: 22px; color: var(--muted); font-weight: 700; font-size: .85rem; text-align: center; }
.thumb {
  display: grid; place-items: center; width: 56px; height: 56px; overflow: hidden; border-radius: 8px;
  background: repeating-conic-gradient(#eee8dc 0 25%, #fff 0 50%) 0 0 / 12px 12px;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.pdf-thumb { background: var(--wine-soft); color: var(--wine); font-weight: 800; font-size: .8rem; letter-spacing: .05em; }
.file-info { display: flex; flex-direction: column; min-width: 0; }
.file-name { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { color: var(--muted); font-size: .86rem; }
.file-meta strong { color: var(--ink); }
.file-actions { display: flex; align-items: center; gap: 6px; }
.file-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .86rem; }
.password-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.password-row label { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.password-row input { min-height: 36px; padding: 0 10px; border: 1px solid #d6cab7; border-radius: 8px; font: inherit; }

.pages {
  grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px;
  max-height: 520px; margin: 4px 0 2px; padding: 2px; overflow-y: auto; list-style: none;
}
.page-thumb { display: flex; flex-direction: column; gap: 4px; color: var(--ink); font-size: .82rem; font-weight: 600; text-align: center; text-decoration: none; }
.page-thumb img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; border: 1px solid #e6dccb; border-radius: 6px; background: #fff; }
.page-thumb:hover img { border-color: var(--wine); }
.page-thumb:hover span { color: var(--wine); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 16px 0 0; }
.actions .count { margin-right: auto; color: var(--muted); font-size: .9rem; }
.actions .hint { color: var(--muted); font-size: .86rem; }
.actions .text-button { margin-left: auto; }
.results:empty { display: none; }
.results { margin-top: 20px; padding-top: 16px; border-top: 1px solid #ece3d4; }
.results-title { margin: 0; font-size: 1.05rem; }
.results .files { margin-top: 10px; }
.results-actions { margin: 12px 0 0; }

.converter-privacy { margin: 20px 0 0; color: var(--muted); font-size: .88rem; text-align: center; }

/* ---------- articles ---------- */
.article { max-width: 760px; padding: 6px 0 30px; }
.article p, .article li { color: #3a3238; }
.article ul, .article ol { padding-left: 1.3em; }
.article li + li { margin-top: 6px; }
.steps ol li::marker { color: var(--wine); font-weight: 700; }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.mode-grid h3 { margin: 0 0 6px; font-size: 1.08rem; }
.mode-grid p { margin: 0 0 8px; font-size: .95rem; }
.modes { max-width: none; }
.mode-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 600; font-size: .92rem !important; }
.table-wrap { overflow-x: auto; }
.formats { width: 100%; border-collapse: collapse; font-size: .94rem; }
.formats th, .formats td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.formats thead th { color: var(--muted); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.formats tbody th { color: var(--wine); }

.popular { padding: 6px 0 34px; }
.popular-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.popular-list a {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  font-weight: 600; font-size: .92rem; text-decoration: none;
}
.popular-list a:hover { border-color: var(--wine); }
.popular-list a[aria-current="page"] { background: var(--wine); border-color: var(--wine); color: #fff; }
.popular-note { margin: 12px 0 0; color: var(--muted); font-size: .88rem; }

.faq { max-width: 780px; padding: 4px 0 56px; }
.faq details { padding: 14px 0; border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; color: #382534; }
.faq p { margin: 10px 0 0; color: var(--muted); }

/* ---------- guide ---------- */
.guide-steps { padding: 0 !important; list-style: none; }
.guide-step + .guide-step { margin-top: 34px; }
.guide-step h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 1.15rem; }
.step-number { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--wine); color: #fff; font-size: .9rem; }
.guide-step figure { margin: 14px 0 0; }
.guide-step img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px #49302414; }
.guide-section { max-width: 860px; }

/* ---------- policy ---------- */
.policy { max-width: 760px; padding: 36px 0 56px; }
.policy h1 { font-size: clamp(38px, 5vw, 52px); }
.policy h2 { margin: 30px 0 6px; font: 700 1.05rem / 1.4 "DM Sans", "Segoe UI", sans-serif; }
.policy-meta { color: var(--muted); font-size: .88rem; }

/* ---------- ads: space reserved so late-loading ads do not push content ---------- */
.ad-slot { display: block; min-height: 280px; margin: 8px 0 38px; padding-top: 4px; }
.ad-label { display: block; margin-bottom: 4px; color: #8a8086; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }

@media (max-width: 760px) {
  .mode-grid { grid-template-columns: 1fr; }
  .topbar nav { gap: 12px; }
  .topbar nav a { font-size: .84rem; }
  .brand span { font-size: .95rem; }
}
@media (max-width: 520px) {
  .brand span { display: none; }
  .tabs { overflow: visible; }
  .tabs [role="tab"] { flex: 1 1 0; min-width: 0; padding: 6px 4px; font-size: .84rem; line-height: 1.2; white-space: normal; }
  .file { grid-template-columns: auto minmax(0, 1fr); }
  .file-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .reorder .file { grid-template-columns: auto auto minmax(0, 1fr); }
  .field input[type="range"] { width: 150px; }
  .actions .text-button { margin-left: 0; }
}
