:root {
  --ink: #16233f;
  --ink-2: #4a5670;
  --ink-3: #6b7489;
  --paper: #ffffff;
  --desk: #edf0f4;
  --line: #d3d9e2;
  --line-strong: #b4bdcb;
  --marker: #ffe14d;
  --marker-deep: #f5cf1d;
  --alert: #b3261e;
  --alert-bg: #fdecea;
  --ok: #1e6e48;
  --ok-bg: #e7f4ec;
  --focus: #2f5bd3;
  --radius-sheet: 6px;
  --radius-ctl: 8px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 1080px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
}

img, svg, canvas { display: block; max-width: 100%; }

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 12px; top: 12px; }

/* Header and footer */

.site-head { background: var(--paper); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 32px; flex: none; }
.brand span { font-weight: 500; color: var(--ink-2); }

.site-nav { display: flex; gap: 22px; font-size: 0.95rem; }
.site-nav a { text-decoration: none; color: var(--ink-2); }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); text-decoration: underline; }

.site-foot { margin-top: 80px; padding: 36px 0 48px; border-top: 1px solid var(--line); background: var(--paper); font-size: 0.92rem; color: var(--ink-2); }
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
.foot-grid h2 { font-size: 0.95rem; margin: 0 0 10px; color: var(--ink); }
.foot-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot-grid a { color: var(--ink-2); text-decoration: none; }
.foot-grid a:hover { color: var(--ink); text-decoration: underline; }
.foot-note { margin-top: 28px; }

/* Type */

h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: 1.55rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 60ch; }

/* Home */

.hero { padding: 64px 0 40px; }
.hero h1 { max-width: 16ch; }
.hero .lede { margin-top: 18px; }
.private-line { display: flex; align-items: center; gap: 10px; margin-top: 22px; font-weight: 600; font-size: 0.98rem; }
.private-line svg { width: 20px; height: 20px; flex: none; }

.catalog { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 16px; }
.cat h2 { font-size: 1.05rem; color: var(--ink-2); font-weight: 600; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
.tool-list { list-style: none; margin: 0; padding: 0; }
.tool-link { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: center; padding: 12px 10px; margin: 0 -10px; border-radius: var(--radius-ctl); text-decoration: none; }
.tool-link:hover { background: var(--paper); }
.tool-link:hover .tool-name { text-decoration: underline; }
.tool-icon { width: 44px; height: 44px; border-radius: var(--radius-ctl); background: var(--paper); border: 1px solid var(--line); display: grid; place-items: center; }
.tool-link:hover .tool-icon { background: var(--marker); border-color: var(--marker-deep); }
.tool-icon svg { width: 24px; height: 24px; }
.tool-name { font-weight: 700; display: block; }
.tool-desc { font-size: 0.9rem; color: var(--ink-2); display: block; line-height: 1.4; }

.reasons { margin-top: 72px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.reasons h2 { font-size: 1.15rem; margin-bottom: 8px; }
.reasons p { color: var(--ink-2); }

/* Tool page */

.crumbs { padding-top: 28px; font-size: 0.9rem; color: var(--ink-2); }
.crumbs a { color: var(--ink-2); }
.tool-head { padding: 14px 0 28px; }
.tool-head .lede { margin-top: 12px; }

.sheet {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius-sheet);
  box-shadow: 0 1px 0 var(--line), 0 12px 30px -18px rgba(22, 35, 63, 0.35);
}

/* Folded corner: the signature of the site */
.sheet.folded { clip-path: polygon(0 0, calc(100% - 44px) 0, 100% 44px, 100% 100%, 0 100%); }
.sheet.folded::after {
  content: "";
  position: absolute; top: 0; right: 0; width: 44px; height: 44px;
  background: linear-gradient(225deg, var(--desk) 50%, #d9dee6 50%);
  border-bottom-left-radius: 6px;
}

.drop {
  padding: 56px 24px 52px;
  text-align: center;
  border: 2px dashed transparent;
  transition: border-color 0.15s, background-color 0.15s;
}
.drop.is-over { border-color: var(--ink); background: #fffbe0; }
.drop-icon { width: 54px; height: 64px; margin: 0 auto 18px; }
.drop-title { font-size: 1.3rem; font-weight: 700; }
.drop-note { margin-top: 10px; color: var(--ink-2); font-size: 0.95rem; }
.drop .btn { margin-top: 22px; }
.drop.compact { padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; flex-wrap: wrap; }
.drop.compact .drop-icon, .drop.compact .drop-title { display: none; }
.drop.compact .btn { margin-top: 0; order: 2; }
.drop.compact .drop-note { margin-top: 0; }

.safe-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 0.92rem; color: var(--ink-2); }
.safe-note svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }

/* Buttons and controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border-radius: var(--radius-ctl);
  border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 1rem;
  cursor: pointer; text-decoration: none;
  position: relative;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--marker); border-color: var(--marker-deep); box-shadow: inset 0 -3px 0 var(--marker-deep); }
.btn-primary:hover { background: #ffd83a; border-color: var(--ink); }
.btn-big { min-height: 54px; padding: 0 30px; font-size: 1.08rem; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 0.9rem; font-weight: 600; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.icon-btn { width: 36px; height: 36px; padding: 0; min-height: 36px; }
.icon-btn svg { width: 18px; height: 18px; }

.work { margin-top: 20px; }
.panel { padding: 22px; }
.panel + .panel { margin-top: 16px; }
.panel-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 20px; }

.field { display: grid; gap: 6px; }
.field-label { font-weight: 600; font-size: 0.95rem; }
.field-help { font-size: 0.85rem; color: var(--ink-2); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; }

input[type="text"], input[type="number"], select {
  font: inherit; font-size: 1rem; color: var(--ink);
  min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-ctl); background: var(--paper);
  width: 100%;
}
input[type="range"] { width: 100%; accent-color: var(--ink); }
input[type="color"] { width: 54px; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-ctl); background: var(--paper); padding: 4px; }

.choice-group { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; }
.choice-group legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; padding: 0; }
.choice { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-ctl); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink); background: #fffbe0; }
.choice input { margin: 4px 0 0; accent-color: var(--ink); width: 18px; height: 18px; }
.choice strong { display: block; }
.choice span { font-size: 0.9rem; color: var(--ink-2); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

/* File list */

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-ctl); background: var(--paper); }
.file-thumb { width: 40px; height: 48px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; background: var(--desk); }
.file-meta { min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.file-info { font-size: 0.85rem; color: var(--ink-2); }
.file-ctl { display: flex; gap: 6px; }

/* Page grid */

.grid-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.grid-hint { font-size: 0.9rem; color: var(--ink-2); }
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.page-tile { min-width: 0; background: var(--desk); border-radius: var(--radius-ctl); padding: 10px; display: grid; gap: 8px; border: 2px solid transparent; }
.page-tile.is-dragging { opacity: 0.4; }
.page-tile.is-target { border-color: var(--ink); }
.page-tile.is-deleted .page-frame { opacity: 0.3; }
.page-tile.is-deleted .page-frame::after { content: "Removed"; position: absolute; inset: auto 0 45% 0; z-index: 1; text-align: center; font-weight: 700; color: var(--alert); }
.page-frame { position: relative; aspect-ratio: 3 / 4; display: grid; place-items: center; min-width: 0; overflow: hidden; }
.page-frame canvas { position: absolute; inset: 0; margin: auto; max-height: 100%; max-width: 100%; width: auto; height: auto; box-shadow: 0 1px 4px rgba(22, 35, 63, 0.25); background: #fff; transition: transform 0.2s; }
.page-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.page-bar .page-num { flex: 1 0 100%; }
.page-num { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.page-bar .file-ctl { gap: 4px; }
.page-bar .icon-btn { width: 32px; height: 32px; min-height: 32px; }
.page-tile[draggable="true"] { cursor: grab; }

/* Status and result */

.status { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-ctl); font-size: 0.95rem; }
.status[hidden] { display: none; }
.status.is-error { background: var(--alert-bg); color: var(--alert); font-weight: 600; }
.status.is-info { background: var(--paper); border: 1px solid var(--line); }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--ink); width: 0; transition: width 0.2s; }

.result { padding: 28px; margin-top: 20px; }
.result h2 { font-size: 1.4rem; }
.result p { margin-top: 8px; color: var(--ink-2); }
.result .actions { margin-top: 18px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; margin-top: 20px; }
.result-grid a { display: grid; gap: 6px; font-size: 0.85rem; text-decoration: none; color: var(--ink-2); }
.result-grid img { border: 1px solid var(--line); border-radius: 3px; background: #fff; }

/* Signature */

.sig-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.sig-tabs .btn[aria-selected="true"] { border-color: var(--ink); background: #fffbe0; }
.sig-pad { width: 100%; height: 180px; border: 1px dashed var(--line-strong); border-radius: var(--radius-ctl); background: #fff; touch-action: none; cursor: crosshair; }
.sig-type-preview { height: 120px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-ctl); font-family: "Caveat", cursive; font-size: 3rem; overflow: hidden; margin-top: 10px; }
.place-stage { position: relative; display: inline-block; max-width: 100%; margin-top: 12px; cursor: copy; }
.place-stage canvas { box-shadow: 0 1px 6px rgba(22, 35, 63, 0.3); }
.place-sig { position: absolute; outline: 2px dashed var(--focus); pointer-events: none; }
.pager { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

/* Content below tools */

.content { margin-top: 64px; display: grid; gap: 56px; }
.content section > h2 { margin-bottom: 18px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: step; }
.steps li { counter-increment: step; padding-top: 14px; border-top: 3px solid var(--ink); }
.steps li::before { content: counter(step); display: block; font-weight: 800; font-size: 1.6rem; line-height: 1; margin-bottom: 10px; }
.steps h3 { margin-bottom: 6px; }
.steps p { color: var(--ink-2); }

.prose { max-width: 68ch; }
.prose p + p { margin-top: 14px; }
.prose p { color: var(--ink-2); }

.faq { max-width: 76ch; border-top: 1px solid var(--line-strong); }
.faq details { border-bottom: 1px solid var(--line-strong); }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 400; font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 0 18px; color: var(--ink-2); max-width: 68ch; }

.related { display: flex; flex-wrap: wrap; gap: 10px; }
.related a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-ctl); text-decoration: none; font-weight: 600; }
.related a:hover { border-color: var(--ink); }
.related svg { width: 22px; height: 22px; }

.page-doc { padding: 40px 0; }
.page-doc .prose { margin-top: 24px; }
.page-doc h2 { margin-top: 32px; margin-bottom: 10px; font-size: 1.3rem; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 860px) {
  .catalog, .reasons, .steps { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding-top: 40px; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .site-nav a.nav-secondary { display: none; }
  .drop { padding: 40px 18px; }
  .panel, .result { padding: 18px; }
  .page-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .file-item { grid-template-columns: 36px 1fr; }
  .file-ctl { grid-column: 1 / -1; justify-content: flex-end; }
  .btn-big { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
