/* Bluepencil. Design tokens first, then base, then one block per component. */

:root {
  --paper: #f2f5fa;        /* page */
  --sheet: #ffffff;        /* documents and fields */
  --ink: #14213a;          /* text */
  --ink-soft: #4d5a73;     /* secondary text */
  --pencil: #1f56cf;       /* the editor's blue pencil: actions and marks */
  --pencil-ink: #ffffff;   /* text on pencil */
  --marker: #ffe873;       /* highlighter */
  --marker-ink: #14213a;
  --rule: #cfd8e6;
  --bad: #c22f49;
  --warn: #a45f00;
  --ok: #137a4b;
  --shadow: 0 1px 2px rgba(20, 33, 58, 0.08), 0 12px 32px -12px rgba(20, 33, 58, 0.28);

  --ui: "Schibsted Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --doc: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: clamp(2.1rem, 1.3rem + 3.6vw, 3.6rem);
  --measure: 34rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1626;
    --sheet: #18233a;
    --ink: #e9eef8;
    --ink-soft: #a6b2c8;
    --pencil: #8db0ff;
    --pencil-ink: #0e1626;
    --marker: #f3d84a;
    --marker-ink: #14213a;
    --rule: #2c3a56;
    --bad: #ff8a9c;
    --warn: #f0b458;
    --ok: #6fd3a2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -12px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: var(--step-0);
  line-height: 1.5;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: var(--step-3); font-weight: 800; }
h2 { font-size: var(--step-2); font-weight: 800; }
h3 { font-size: var(--step-1); font-weight: 700; }
a { color: var(--pencil); text-underline-offset: 0.18em; }
[hidden] { display: none !important; }

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

.wrap { width: min(100% - 2.5rem, 70rem); margin-inline: auto; }
.soft { color: var(--ink-soft); }
.small { font-size: var(--step--1); }

/* ---- top bar ---- */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-block: 1.25rem; }
.brand { font-weight: 800; font-size: var(--step-1); letter-spacing: -0.03em; color: var(--ink); text-decoration: none; background: linear-gradient(var(--pencil), var(--pencil)) 0 100% / 100% 3px no-repeat; padding-bottom: 2px; }
.banner { background: var(--marker); color: var(--marker-ink); padding: 0.5rem 1rem; text-align: center; font-size: var(--step--1); font-weight: 500; }

/* ---- buttons and fields ---- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 3rem; padding: 0.7rem 1.3rem; border: 2px solid var(--pencil); border-radius: 8px; background: var(--pencil); color: var(--pencil-ink); font: 700 var(--step-0) / 1.2 var(--ui); text-decoration: none; cursor: pointer; }
.button:hover { filter: brightness(1.08); }
.button[disabled] { opacity: 0.6; cursor: progress; }
.button.quiet { background: transparent; color: var(--pencil); min-height: 2.5rem; padding: 0.4rem 0.9rem; }
.button.danger { border-color: var(--bad); color: var(--bad); }
.textlink { border: 0; padding: 0; background: none; color: var(--pencil); font: inherit; text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }

.field { display: grid; gap: 0.35rem; }
.field > label, .field > .label { font-weight: 700; font-size: var(--step--1); }
.field .optional { font-weight: 400; color: var(--ink-soft); }
.field input, .field textarea { width: 100%; padding: 0.7rem 0.8rem; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--sheet); color: var(--ink); font: inherit; }
.field input:hover, .field textarea:hover { border-color: var(--ink-soft); }
.field textarea { min-height: 9rem; resize: vertical; }

.error { padding: 0.75rem 1rem; border-left: 4px solid var(--bad); border-radius: 4px; background: var(--sheet); color: var(--bad); font-weight: 500; }

/* ---- landing: hero ---- */
.hero { display: grid; gap: 3rem; padding-block: 1.5rem 4rem; align-items: start; }
@media (min-width: 60rem) { .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); gap: 4rem; padding-block: 3rem 5rem; } }
.pitch { display: grid; gap: 1.25rem; max-width: var(--measure); }
.lede { font-size: var(--step-1); line-height: 1.4; color: var(--ink-soft); }

.review-form { display: grid; gap: 1.1rem; margin-top: 0.5rem; }
.drop { display: grid; gap: 0.2rem; justify-items: start; padding: 1.25rem; border: 2px dashed var(--pencil); border-radius: 10px; background: var(--sheet); cursor: pointer; }
.drop.over { background: color-mix(in srgb, var(--pencil) 12%, var(--sheet)); }
.drop strong { font-size: var(--step-1); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--pencil); outline-offset: 2px; }
.drop .picked { font-weight: 700; color: var(--pencil); overflow-wrap: anywhere; }
#file-block { display: grid; gap: 0.6rem; }
.review-form details summary { cursor: pointer; color: var(--pencil); font-weight: 500; }
.review-form details[open] summary { margin-bottom: 0.6rem; }
.review-form .button { width: 100%; }

/* ---- landing: the marked-up specimen (the one loud element) ---- */
.specimen { position: relative; padding: 2rem 1.5rem 2.25rem; background: var(--sheet); border-radius: 3px; box-shadow: var(--shadow); font-family: var(--doc); font-size: 0.95rem; line-height: 1.65; transform: rotate(1.2deg); max-width: 32rem; justify-self: center; }
@media (min-width: 60rem) { .specimen { padding: 2.75rem 2.5rem 3rem; margin-top: 1rem; } }
.specimen .name { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.specimen .name, .specimen .contact { padding-right: 5.5rem; }
.specimen .contact { color: var(--ink-soft); font-size: 0.85rem; }
.specimen .heading { margin-top: 1.4rem; padding-bottom: 0.15rem; border-bottom: 1px solid var(--ink); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; }
.specimen .role { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.6rem; font-weight: 600; }
.specimen .role span:last-child { font-weight: 400; color: var(--ink-soft); white-space: nowrap; }
.specimen li { position: relative; padding-left: 1.1rem; margin-top: 0.35rem; }
.specimen li::before { content: "\2022"; position: absolute; left: 0.15rem; }

.struck { background: linear-gradient(var(--pencil), var(--pencil)) 0 55% / 100% 2px no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.ringed { padding: 0.05em 0.35em; margin-inline: -0.2em; border: 2px solid var(--pencil); border-radius: 52% 46% 55% 44% / 60% 48% 58% 46%; }
.note { display: block; font-family: var(--hand); font-size: 1.35rem; line-height: 1.15; color: var(--pencil); transform: rotate(-1.5deg); transform-origin: left; margin: 0.1rem 0 0.25rem; }
.grade { position: absolute; top: 1rem; right: 1rem; display: grid; place-items: center; width: 5.4rem; height: 4rem; border: 2.5px solid var(--pencil); border-radius: 50% 44% 52% 46% / 48% 56% 44% 52%; font-family: var(--hand); font-size: 1.6rem; font-weight: 700; color: var(--pencil); transform: rotate(-8deg); }

@media (prefers-reduced-motion: no-preference) {
  .struck { background-size: 0 2px; animation: strike 0.5s ease-out forwards; }
  .note, .grade, .ringed { animation: appear 0.45s ease-out both; }
  .struck.s1 { animation-delay: 0.5s; } .note.n1 { animation-delay: 1s; }
  .ringed { animation-delay: 1.6s; } .note.n2 { animation-delay: 2s; }
  .note.n3 { animation-delay: 2.6s; } .grade { animation-delay: 3.2s; }
  @keyframes strike { to { background-size: 100% 2px; } }
  @keyframes appear { from { opacity: 0; } to { opacity: 1; } }
  .ringed { border-color: transparent; animation-name: ring; }
  @keyframes ring { to { border-color: var(--pencil); } }
}

/* ---- landing: lower sections ---- */
.band { padding-block: 3.5rem; border-top: 1px solid var(--rule); }
.band > h2 { margin-bottom: 2rem; }
.returns { display: grid; gap: 2rem; }
@media (min-width: 48rem) { .returns { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3rem; } }
.returns h3 { margin-bottom: 0.5rem; }
.returns p { color: var(--ink-soft); }

.faq { max-width: 44rem; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { padding: 1rem 0; font-weight: 700; font-size: 1.1rem; cursor: pointer; }
.faq details p { padding-bottom: 1.1rem; color: var(--ink-soft); max-width: var(--measure); }

.foot { padding-block: 2rem 3rem; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: var(--step--1); }

/* ---- result page: states ---- */
.state { max-width: var(--measure); padding-block: 4rem; display: grid; gap: 1rem; justify-items: start; }
.spinner { width: 2.5rem; height: 2.5rem; border: 4px solid var(--rule); border-top-color: var(--pencil); border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) { .spinner { animation: spin 0.9s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } } }

/* ---- result page: summary ---- */
.summary { display: grid; gap: 2rem; padding-block: 2rem 3rem; align-items: center; }
@media (min-width: 52rem) { .summary { grid-template-columns: auto minmax(0, 1fr); gap: 3rem; } }
.dial { position: relative; width: 11rem; height: 11rem; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial circle { fill: none; stroke-width: 9; }
.dial .track { stroke: var(--rule); }
.dial .value { stroke: currentColor; stroke-linecap: round; }
.dial .number { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--ink); }
.dial .number b { font-size: 3.4rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; }
.dial .number span { font-size: var(--step--1); color: var(--ink-soft); }
.tone-bad { color: var(--bad); } .tone-warn { color: var(--warn); } .tone-ok { color: var(--ok); }
.summary .verdict { font-size: var(--step-1); line-height: 1.4; max-width: var(--measure); margin-top: 0.75rem; }

.bars { display: grid; gap: 1rem 2.5rem; padding-bottom: 3rem; }
@media (min-width: 52rem) { .bars { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bar .head { display: flex; justify-content: space-between; font-weight: 700; }
.bar .head span:first-child { color: var(--ink); }
.bar .meter { height: 8px; margin-block: 0.35rem; border-radius: 4px; background: var(--rule); overflow: hidden; }
.bar .meter i { display: block; height: 100%; border-radius: 4px; background: currentColor; }
.bar p { color: var(--ink-soft); font-size: var(--step--1); }

/* ---- result page: critique ---- */
.section { padding-block: 2.5rem; border-top: 1px solid var(--rule); }
.section > h2 { margin-bottom: 1.5rem; }
.issues { display: grid; gap: 2rem; max-width: 46rem; counter-reset: issue; }
.issue { display: grid; gap: 0.5rem; padding-left: 2.75rem; position: relative; counter-increment: issue; }
.issue::before { content: counter(issue); position: absolute; left: 0; top: -0.1rem; width: 2rem; height: 2rem; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 50%; font-weight: 800; font-size: var(--step--1); }
.issue h3 { color: var(--ink); }
.issue .severity { font-size: var(--step--1); font-weight: 700; }
.issue p { color: var(--ink); max-width: var(--measure); }
.rewrite-pair { display: grid; gap: 0.4rem; margin-top: 0.35rem; padding: 0.9rem 1rem; background: var(--sheet); border-radius: 6px; font-family: var(--doc); color: var(--ink); max-width: var(--measure); }
.rewrite-pair .before { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--pencil); text-decoration-thickness: 2px; }
.rewrite-pair .after { font-weight: 600; }

.ticks { display: grid; gap: 0.6rem; max-width: var(--measure); }
.ticks li { padding-left: 1.6rem; position: relative; }
.ticks li::before { content: "\2713"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li { padding: 0.25rem 0.7rem; border: 1.5px solid var(--pencil); border-radius: 999px; color: var(--pencil); font-weight: 500; font-size: var(--step--1); }

/* ---- result page: the rewritten resume ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; align-items: center; }
.toolbar .status { color: var(--ok); font-weight: 700; font-size: var(--step--1); }
.fill-in { max-width: 46rem; margin-bottom: 1.5rem; padding: 1rem 1.1rem; background: var(--marker); color: var(--marker-ink); border-radius: 6px; }
.fill-in ul { margin-top: 0.5rem; display: grid; gap: 0.3rem; font-size: var(--step--1); list-style: disc; padding-left: 1.2rem; }
.page { max-width: 46rem; padding: 2rem 1.5rem; background: var(--sheet); border-radius: 3px; box-shadow: var(--shadow); font-family: var(--doc); font-size: 1rem; line-height: 1.6; overflow-wrap: anywhere; }
@media (min-width: 48rem) { .page { padding: 3.5rem 4rem; } }
.page .r-name { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.page .r-contact { color: var(--ink-soft); }
.page .r-heading { margin-top: 1.5rem; margin-bottom: 0.4rem; padding-bottom: 0.15rem; border-bottom: 1px solid var(--ink); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.1em; }
.page .r-bullet { padding-left: 1.1rem; position: relative; }
.page .r-bullet::before { content: "\2022"; position: absolute; left: 0.15rem; }
.page .r-gap { height: 0.6rem; }
.page mark { background: var(--marker); color: var(--marker-ink); padding: 0 0.15em; border-radius: 2px; }

.privacy { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; }

/* ---- admin ---- */
.admin { padding-block: 2rem 4rem; display: grid; gap: 1.5rem; }
.admin form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; max-width: 32rem; }
.admin form .field { flex: 1 1 14rem; }
.scroll { overflow-x: auto; }
.orders { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.orders th, .orders td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.orders th { font-weight: 700; white-space: nowrap; }
.orders tr.flagged td { background: color-mix(in srgb, var(--marker) 30%, transparent); }
.orders .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.orders .button { min-height: 2rem; padding: 0.2rem 0.6rem; font-size: var(--step--1); }

/* ---- setup page ---- */
.plain { list-style: disc; padding-left: 1.2rem; display: grid; gap: 0.3rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
.setup-block { display: grid; gap: 1rem; padding-top: 2rem; border-top: 1px solid var(--rule); }
.setup-block .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.checks { display: grid; gap: 0.75rem; max-width: 52rem; }
.check { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); column-gap: 0.5rem; }
.check .mark { grid-row: span 2; width: 1.5rem; height: 1.5rem; display: grid; place-items: center; border-radius: 50%; border: 2px solid currentColor; font-weight: 800; font-size: 0.8rem; line-height: 1; }
.check.ok .mark { color: var(--ok); } .check.warn .mark { color: var(--warn); } .check.fail .mark { color: var(--bad); }
.check .detail { color: var(--ink-soft); font-size: var(--step--1); overflow-wrap: anywhere; }
.result-card { display: grid; gap: 0.5rem; max-width: 52rem; margin-bottom: 1rem; padding: 1rem 1.1rem; background: var(--sheet); border-left: 4px solid var(--rule); border-radius: 4px; overflow-wrap: anywhere; }
.result-card.ok { border-left-color: var(--ok); } .result-card.fail { border-left-color: var(--bad); }
.sheet-preview { margin: 0.5rem 0 0; padding: 1rem; max-height: 22rem; overflow: auto; background: var(--paper); border-radius: 4px; font-family: var(--doc); font-size: 0.9rem; white-space: pre-wrap; }
.report { width: 100%; max-width: 52rem; padding: 0.8rem; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--sheet); color: var(--ink); font: 0.85rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ---- print: only the rewritten resume ---- */
@media print {
  body { background: #fff; color: #000; }
  body > *:not(main), main > *:not(#done), #done > *:not(#rewrite), #rewrite > *:not(.page) { display: none !important; }
  .section { border: 0; padding: 0; }
  .page { box-shadow: none; padding: 0; max-width: none; color: #000; background: #fff; }
  .page mark { background: none; }
}
