/* ===========================================================
   GoToPDF — "Postal Stamp" design system
   =========================================================== */

@font-face {
  font-family: 'Fraunces';
  src: local('Fraunces');
}

:root {
  /* Paper & ink */
  --paper: #ffffff;
  --paper-deep: #f2f2f2;
  --paper-line: #d9d9d9;
  --ink: #0a0a0a;
  --ink-soft: #3d3d3d;
  --ink-faint: #767676;

  /* Stamp palette — red / black / white */
  --stamp-red: #d1170a;
  --stamp-red-dark: #970f04;
  --postmark-navy: #0a0a0a;
  --postmark-navy-soft: #2b2b2b;
  --ok-green: #0a0a0a;

  --card: #ffffff;
  --shadow-hard: 6px 6px 0 rgba(0, 0, 0, 0.9);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.14);

  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --radius: 2px;
}

:root[data-theme="dark"] {
  --paper: #0a0a0a;
  --paper-deep: #000000;
  --paper-line: #333333;
  --ink: #ffffff;
  --ink-soft: #d4d4d4;
  --ink-faint: #8f8f8f;
  --card: #151515;
  --stamp-red: #ff4433;
  --stamp-red-dark: #d1170a;
  --postmark-navy: #ffffff;
  --postmark-navy-soft: #c9c9c9;
  --ok-green: #ffffff;
  --shadow-hard: 6px 6px 0 rgba(255, 68, 51, 0.85);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0a0a0a;
    --paper-deep: #000000;
    --paper-line: #333333;
    --ink: #ffffff;
    --ink-soft: #d4d4d4;
    --ink-faint: #8f8f8f;
    --card: #151515;
    --stamp-red: #ff4433;
    --stamp-red-dark: #d1170a;
    --postmark-navy: #ffffff;
    --postmark-navy-soft: #c9c9c9;
    --ok-green: #ffffff;
    --shadow-hard: 6px 6px 0 rgba(255, 68, 51, 0.85);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-mono);
  color: var(--ink);
  background:
    radial-gradient(rgba(34,28,20,0.06) 1px, transparent 1.2px) 0 0/22px 22px,
    var(--paper);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--stamp-red);
  color: var(--paper);
}

a { color: var(--postmark-navy); }
a:hover { color: var(--stamp-red); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

p { color: var(--ink-soft); }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Texture edges ---------- */
.perforated {
  border-top: 2px dashed var(--paper-line);
}

.perforated-bottom {
  border-bottom: 2px dashed var(--paper-line);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 2px dashed var(--paper-line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand-word {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-word .go { color: var(--stamp-red); }

nav.mainnav {
  display: flex;
  align-items: center;
  gap: 28px;
}

nav.mainnav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  transition: color .15s ease;
}
nav.mainnav a:hover { color: var(--stamp-red); }

.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--ink);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 13px 22px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, opacity .12s ease;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-hard);
}
.btn:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 rgba(34,28,20,0.9); }
.btn:active:not(:disabled) { transform: translate(0, 0); box-shadow: 2px 2px 0 rgba(34,28,20,0.9); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--stamp-red);
  border-color: var(--stamp-red-dark);
  color: #fdf6ea;
}
.btn-primary:hover:not(:disabled) { background: var(--stamp-red-dark); }

.btn-ghost {
  background: transparent;
}

.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.75rem; }

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 40px;
  position: relative;
  overflow: hidden;
}

.hero-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--postmark-navy);
  border: 2px solid var(--postmark-navy);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(2.6rem, 5.6vw, 4.4rem);
  line-height: 1.02;
  max-width: 16ch;
}

.hero h1 .stampword {
  position: relative;
  display: inline-block;
  color: var(--stamp-red);
  font-style: italic;
}

.hero-sub {
  max-width: 56ch;
  font-size: 1.15rem;
  margin-top: 18px;
}

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 28px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.hero-trust span { display: flex; align-items: center; gap: 8px; }
.hero-trust svg { flex-shrink: 0; color: var(--ok-green); }

/* ---------- Converter card ---------- */
.converter {
  margin-top: 48px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: var(--shadow-hard);
  position: relative;
}

.dropzone {
  margin: 22px;
  border: 3px dashed var(--paper-line);
  border-radius: 4px;
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  position: relative;
}

.dropzone.dragover {
  border-color: var(--stamp-red);
  background: rgba(177, 54, 30, 0.06);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  color: var(--ink-faint);
}

.dropzone h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.dropzone p {
  font-size: 0.85rem;
  margin: 0;
}

.dropzone input[type="file"] { display: none; }

.dropzone .browse-link {
  color: var(--stamp-red);
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
}

.filetypes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}
.filetypes-row .chip {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border: 1.5px solid var(--paper-line);
  border-radius: 999px;
  color: var(--ink-faint);
}

/* file queue */
.filequeue {
  padding: 0 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  border: 1.5px solid var(--paper-line);
  border-radius: 3px;
  padding: 12px 14px;
  animation: rowIn .3s ease both;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.file-icon {
  width: 34px;
  height: 34px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--postmark-navy);
  color: var(--paper);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.file-meta { min-width: 0; }
.file-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.file-status {
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-status.error { color: var(--stamp-red); }
.file-status.done { color: var(--ok-green); }

.progress-track {
  width: 90px;
  height: 5px;
  background: var(--paper-line);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--postmark-navy);
  transition: width .2s ease;
}

.target-select {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 7px 10px;
  border: 1.5px solid var(--paper-line);
  border-radius: 3px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  justify-self: start;
}
.target-select:disabled { opacity: 0.5; cursor: not-allowed; }
.target-select--disabled {
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  padding: 7px 10px;
  color: var(--ink-faint);
  border: 1.5px dashed var(--paper-line);
  border-radius: 3px;
  white-space: nowrap;
}

.file-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--paper-line);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all .12s ease;
}
.icon-btn:hover { border-color: var(--stamp-red); color: var(--stamp-red); }

/* stamp mark that pops on completion */
.stamp-mark {
  position: relative;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stamp-mark svg {
  width: 30px;
  height: 30px;
  color: var(--ok-green);
  transform: scale(0) rotate(-25deg);
  opacity: 0;
}
.stamp-mark.pop svg {
  animation: stampSlam .38s cubic-bezier(.2,1.4,.5,1) forwards;
}
@keyframes stampSlam {
  0% { transform: scale(2.4) rotate(-25deg); opacity: 0; }
  60% { transform: scale(0.92) rotate(-18deg); opacity: 1; }
  100% { transform: scale(1) rotate(-14deg); opacity: 1; }
}

.converter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-top: 2px dashed var(--paper-line);
}

.converter-footer-note {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.converter-actions { display: flex; gap: 10px; }

/* ---------- Sections ---------- */
.section {
  padding: 88px 0;
}
.section-head {
  max-width: 60ch;
  margin-bottom: 46px;
}
.section-kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--stamp-red);
  font-weight: 700;
  margin-bottom: 10px;
}
.section h2 {
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 26px;
  box-shadow: var(--shadow-hard);
}

.card .num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-style: italic;
  color: var(--stamp-red);
  line-height: 1;
  margin-bottom: 10px;
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.card p { font-size: 0.92rem; margin: 0; }

.format-card {
  border: 1.5px solid var(--paper-line);
  border-radius: 3px;
  padding: 20px;
  background: var(--paper-deep);
  display: flex;
  align-items: center;
  gap: 14px;
}
.format-card .badge {
  width: 46px;
  height: 46px;
  border-radius: 3px;
  background: var(--postmark-navy);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.65rem;
  flex-shrink: 0;
}
.format-card strong { display: block; font-size: 0.95rem; color: var(--ink); }
.format-card span { font-size: 0.8rem; color: var(--ink-faint); }

/* FAQ accordion */
.faq-item {
  border-bottom: 2px dashed var(--paper-line);
}
.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 20px 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq-q .plus {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--stamp-red);
  border-radius: 50%;
  color: var(--stamp-red);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease;
  font-size: 0.9rem;
}
.faq-item.open .plus { transform: rotate(135deg); }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.faq-a p { padding: 0 0 20px; font-size: 0.94rem; max-width: 66ch; }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 40px auto;
  max-width: 1120px;
  padding: 0 24px;
}
.ad-slot-inner {
  border: 1.5px dashed var(--paper-line);
  border-radius: 3px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ad-label {
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

/* ---------- Footer ---------- */
footer {
  border-top: 2px dashed var(--paper-line);
  padding: 56px 0 32px;
  margin-top: 40px;
  background: var(--paper-deep);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
}
.footer-brand p {
  font-size: 0.85rem;
  max-width: 32ch;
  margin-top: 12px;
}
.footer-col h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 14px;
}
.footer-col a {
  display: block;
  font-size: 0.86rem;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 10px;
}
.footer-col a:hover { color: var(--stamp-red); }

.footer-bottom {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1.5px solid var(--paper-line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

/* ---------- Consent banner ---------- */
.consent-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 620px;
  margin: 0 auto;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: var(--shadow-hard);
  padding: 20px;
  z-index: 100;
  transform: translateY(140%);
  transition: transform .4s cubic-bezier(.2,.9,.3,1);
}
.consent-banner.show { transform: translateY(0); }
.consent-banner p { font-size: 0.82rem; margin: 0 0 14px; }
.consent-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Toast ---------- */
#toast-region {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--ink);
  color: var(--paper);
  border-radius: 3px;
  padding: 12px 16px;
  font-size: 0.82rem;
  box-shadow: var(--shadow-soft);
  animation: rowIn .25s ease both;
  max-width: 320px;
}
.toast.err { background: var(--stamp-red-dark); }

/* ---------- Simple content pages ---------- */
.content-page { padding: 60px 0 90px; }
.content-page h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.content-page .updated { font-size: 0.8rem; color: var(--ink-faint); margin-bottom: 40px; }
.content-page h2 { font-size: 1.4rem; margin-top: 40px; }
.content-page p, .content-page li { color: var(--ink-soft); font-size: 0.98rem; }
.content-page ul { padding-left: 22px; }
.content-page a { text-decoration: underline; }

.breadcrumb {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--ink-faint); text-decoration: none; }
.breadcrumb a:hover { color: var(--stamp-red); }

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--stamp-red);
  color: #fff;
  padding: 10px 16px;
  z-index: 300;
  border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  nav.mainnav { display: none; }
  .nav-toggle { display: flex; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .file-row { grid-template-columns: 34px 1fr; row-gap: 10px; }
  .target-select, .target-select--disabled { grid-column: 1 / -1; width: 100%; justify-self: stretch; }
  .file-actions { grid-column: 1 / -1; justify-content: space-between; }
  .converter-footer { flex-direction: column; align-items: stretch; }
  .converter-actions { justify-content: stretch; }
  .converter-actions .btn { flex: 1; }
}

nav.mainnav.mobile-open {
  display: flex;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--paper);
  border-bottom: 2px dashed var(--paper-line);
  flex-direction: column;
  align-items: flex-start;
  padding: 18px 24px 24px;
  gap: 16px;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
