:root {
  --navy: #194777;
  --navy-2: #215387;
  --ink: #1a202c;
  --ink-2: #2d3748;
  --muted: #555;
  --line: #d8dee8;
  --bg: #f7fafc;
  --panel: #ffffff;
  --cool: #edf2f7;
  --green: #13612e;
  --danger: #b82105;
  --warn: #f7630c;
  --focus: #1159af;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(25, 71, 119, 0.08);
}

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

html { overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}

a { color: var(--navy-2); }
a:hover { color: var(--navy); }

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: #fff;
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

.site-header, .site-footer {
  background: var(--navy);
  color: #fff;
}

.site-header a, .site-footer a { color: #fff; }

.header-inner, .footer-inner, .wrap {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  display: grid;
  place-items: center;
  font-weight: 800;
}

nav.crumbs {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 1.1rem 0 0.4rem;
}
nav.crumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
nav.crumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  color: #99a;
}

h1 {
  font-size: clamp(1.55rem, 4vw, 2.05rem);
  line-height: 1.25;
  margin: 0.2rem 0 0.75rem;
  color: var(--ink);
}

.lede { font-size: 1.05rem; margin: 0 0 1.25rem; color: var(--ink-2); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  margin: 0 0 1.25rem;
}

.dropzone {
  border: 2px dashed #9bb0c7;
  border-radius: 10px;
  background: var(--cool);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
}
.dropzone.dragover {
  border-color: var(--navy);
  background: #e8eef6;
}
.dropzone input[type="file"] {
  display: block;
  width: 100%;
  margin: 0.7rem auto 0;
  max-width: 100%;
}

.controls {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
label.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  min-width: min(100%, 140px);
  flex: 1;
}
label.field input, label.field select, label.inline input {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid #c5ced9;
  border-radius: 8px;
  background: #fff;
  max-width: 100%;
}
label.inline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.presets { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.presets button, button.btn, .btn {
  appearance: none;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 650;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}
.presets button[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
}
button.btn.secondary, .btn.secondary {
  background: #fff;
  color: var(--navy);
}
button.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  background: var(--cool);
}
.status.ok { background: #e7f6ec; color: var(--green); }
.status.bad { background: #fdecea; color: var(--danger); }
.status.warn { background: #fff4e8; color: #8a3d00; }

.preview-wrap {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
}
.preview-wrap img, .preview-wrap canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.crop-frame {
  position: relative;
  width: min(100%, 360px);
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid var(--navy);
  background: #fff;
  touch-action: none;
  user-select: none;
}
.crop-frame canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.85rem;
}
.card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 0.4rem; font-size: 1.15rem; color: var(--navy); }
.card p { margin: 0; color: var(--muted); }

.content h2 { margin-top: 1.8rem; color: var(--navy); }
.content ol, .content ul { padding-left: 1.2rem; }
.faq details {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0;
}
.faq summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--ink-2);
}

.ad-slot {
  min-height: 0;
  margin: 1rem 0;
}
.ad-slot:not([hidden]) {
  min-height: 90px;
  border: 1px dashed #ccd;
  border-radius: 8px;
  /* Intentionally empty — reserved space only, no faux advertisement */
}

.site-footer { margin-top: 2.5rem; }
.footer-inner { padding: 1rem 0 1.3rem; font-size: 0.92rem; }
.footer-inner p { margin: 0.35rem 0; }

@media (max-width: 400px) {
  .header-inner { padding: 0.7rem 0; }
  .panel { padding: 0.85rem; }
}
