/* Resume and CV print documents (kepakisan.co.nz). A4, Tri Datu palette.
   Content lives in #flow; assets/doc/doc.js paginates it into .sheet pages
   after the fonts load. Edit content in the HTML, never the page markup. */

@font-face { font-family: 'Schibsted Grotesk'; src: url('../fonts/SchibstedGrotesk-normal.woff2') format('woff2'); font-weight: 400 900; font-style: normal; font-display: block; }
@font-face { font-family: 'Schibsted Grotesk'; src: url('../fonts/SchibstedGrotesk-italic.woff2') format('woff2'); font-weight: 400 900; font-style: italic; font-display: block; }
@font-face { font-family: 'Newsreader'; src: url('../fonts/Newsreader-normal.woff2') format('woff2'); font-weight: 300 700; font-style: normal; font-display: block; }
@font-face { font-family: 'Newsreader'; src: url('../fonts/Newsreader-italic.woff2') format('woff2'); font-weight: 300 700; font-style: italic; font-display: block; }

:root {
  color-scheme: light;
  --ink: #151515; --ink-2: #45443F; --ink-3: #5E5D57;
  --rule: #DAD9D4; --rule-strong: #B0AFA8; --sunk: #ECECE8;
  --accent: #C83C2B; --paper: #FFFFFF; --band: #F1F0EC;
  --sans: 'Schibsted Grotesk', Arial, sans-serif;
  --serif: 'Newsreader', Georgia, serif;
  /* Density: the paginator lowers this slightly when the last page would
     only hold a few lines. Everything vertical scales with it. */
  --d: 1;
  --fs: calc(8.7pt * var(--d));
  --gap: calc(4.2mm * var(--d));
  --pad-x: 15mm;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: #D9D8D3; font-family: var(--sans); font-size: var(--fs); line-height: 1.45; color: var(--ink); -webkit-font-smoothing: antialiased; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
a { color: inherit; text-decoration: none; }

/* Screen toolbar */
.toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; background: #151515; color: #F2F1EE; font: 13px/1.4 var(--sans); }
.toolbar button { font: 600 13px var(--sans); color: #fff; background: var(--accent); border: 0; border-radius: 6px; padding: 8px 16px; cursor: pointer; }
.toolbar button:hover { background: #A93123; }
.toolbar span { opacity: .75; }

/* Source content is measured inside the pages, never shown directly */
#flow { display: none; }

/* A4 sheets */
#pages { padding: 10mm 0; }
.sheet { width: 210mm; height: 297mm; margin: 0 auto 8mm; background: var(--paper); box-shadow: 0 2px 10px rgba(0, 0, 0, .15); display: flex; flex-direction: column; overflow: hidden; position: relative; }
.sheet-body { flex: 1; min-height: 0; overflow: hidden; padding: 0 var(--pad-x); display: flex; flex-direction: column; gap: var(--gap); }
.sheet-foot { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 3mm var(--pad-x) 7mm; font-size: 7pt; color: var(--ink-3); }
.sheet-foot .pg { font-variant-numeric: tabular-nums; }

/* Tri Datu thread */
.tridatu { height: 2.4mm; background: linear-gradient(to bottom, var(--accent) 0 .8mm, #151515 .8mm 1.6mm, #F2F1EE 1.6mm 2.4mm); box-shadow: inset 0 -.2mm 0 var(--rule); }

/* Page 1 header */
.dh { flex: none; padding: 13mm var(--pad-x) 0; }
.dh-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 6mm; }
.dh-name { font-size: calc(30pt * var(--d)); font-weight: 700; letter-spacing: -.035em; line-height: .95; }
.dh-doc { font-size: 9pt; font-weight: 600; color: var(--accent); padding-bottom: 1mm; }
.dh-title { margin-top: calc(2.4mm * var(--d)); font-size: calc(11pt * var(--d)); font-weight: 500; color: var(--ink-2); }
.dh-meta { margin-top: calc(1.6mm * var(--d)); display: flex; flex-wrap: wrap; gap: 0 5mm; font-size: 8pt; color: var(--ink-3); }
.dh-meta a { color: var(--accent); font-weight: 600; }
.dh .tridatu { margin-top: calc(5mm * var(--d)); }
.dh-stats { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: calc(4mm * var(--d)); border-top: .3mm solid var(--ink); border-bottom: .2mm solid var(--rule); margin-bottom: var(--gap); }
.dh-stats div { padding: calc(2.6mm * var(--d)) 0 calc(2.4mm * var(--d)); }
.dh-stats div + div { padding-left: 3.5mm; border-left: .2mm solid var(--rule); }
.dh-stats b { display: block; font-size: calc(15pt * var(--d)); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; color: var(--accent); }
.dh-stats span { display: block; margin-top: .6mm; font-size: 7.2pt; color: var(--ink-3); }

/* Page 1: masthead, stat bar, banner, then sidebar + main column */
.sheet-first .tridatu { flex: none; }
.mh { flex: none; display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; padding: calc(8mm * var(--d)) var(--pad-x) calc(4mm * var(--d)); }
.mh-eyebrow { font-size: 7.6pt; font-weight: 600; letter-spacing: .02em; color: var(--accent); margin-bottom: calc(2mm * var(--d)); }
.mh-name { font-size: calc(33pt * var(--d)); font-weight: 750; letter-spacing: -.045em; line-height: .9; }
.mh-name em { font-family: var(--serif); font-style: italic; font-weight: 500; letter-spacing: -.02em; color: var(--accent); }
.mh-right { text-align: right; padding-bottom: 1mm; }
.mh-title { font-size: calc(10pt * var(--d)); font-weight: 600; line-height: 1.3; margin-bottom: 1.6mm; }
.mh-meta { font-size: 7.8pt; color: var(--ink-3); line-height: 1.5; }
.mh-meta b { color: var(--ink-2); font-weight: 600; }
.stats { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); margin: 0 var(--pad-x); border-top: .3mm solid var(--ink); border-bottom: .2mm solid var(--rule); }
.stats div { padding: calc(2.4mm * var(--d)) 0 calc(2.2mm * var(--d)); }
.stats div + div { padding-left: 3.5mm; border-left: .2mm solid var(--rule); }
.stats b { display: block; font-size: calc(15pt * var(--d)); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; color: var(--accent); white-space: nowrap; }
.stats span { display: block; margin-top: .5mm; font-size: 7pt; color: var(--ink-3); }
.banner { flex: none; display: flex; align-items: center; gap: 6mm; margin: calc(3mm * var(--d)) var(--pad-x) 0; padding: calc(2.2mm * var(--d)) 5mm; background: var(--accent); color: #fff; border-radius: 1.2mm; }
.banner-l { flex: none; display: flex; flex-direction: column; }
.banner-label { font-size: 6.8pt; opacity: .85; }
.banner-url { font-size: 12pt; font-weight: 700; letter-spacing: -.02em; }
.banner-desc { font-family: var(--serif); font-style: italic; font-size: 8.8pt; line-height: 1.4; padding-left: 6mm; border-left: .2mm solid rgba(255,255,255,.45); }
/* The grid sits inside the page margins so the sidebar lines up with the
   masthead, stats and banner above it */
.p1-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 60mm 1fr; grid-template-rows: minmax(0, 1fr); margin: calc(4mm * var(--d)) var(--pad-x) 0; }
.side { min-height: 0; overflow: hidden; background: var(--band); padding: calc(5mm * var(--d)) 4.5mm 5mm; border-radius: 1.2mm; display: flex; flex-direction: column; gap: calc(4.2mm * var(--d)); }
.s-label { font-size: calc(8.6pt * var(--d)); font-weight: 700; letter-spacing: -.005em; padding-bottom: calc(1.2mm * var(--d)); margin-bottom: calc(1.8mm * var(--d)); border-bottom: .3mm solid var(--ink); }
.s-quote { font-family: var(--serif); font-style: italic; font-size: calc(9.4pt * var(--d)); line-height: 1.45; color: var(--ink); }
.s-list { list-style: none; display: grid; gap: calc(.9mm * var(--d)); font-size: 7.8pt; color: var(--ink-2); }
.s-list a { color: var(--ink); font-weight: 500; border-bottom: .2mm solid var(--rule-strong); }
.s-edu + .s-edu { margin-top: calc(2.2mm * var(--d)); }
.s-deg { font-weight: 600; line-height: 1.3; }
.s-school { font-size: 7.6pt; color: var(--accent); font-weight: 500; }
.s-year { font-size: 7.2pt; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.s-cat { font-size: 7.2pt; font-weight: 600; color: var(--ink-3); margin: calc(1.8mm * var(--d)) 0 1mm; }
.s-sec .s-label + .s-cat { margin-top: 0; }
.side .chip { background: var(--paper); font-size: 6.8pt; padding: .4mm 1.5mm; }
.side .chips { gap: 1mm; }
.p1-main .profile { font-size: calc(9.6pt * var(--d)); line-height: 1.45; }
.side .chip.hi { background: var(--accent); }
/* A long skills list in the sidebar reads as text, not as pills */
.side .s-flat { display: block; font-size: 7.3pt; line-height: 1.5; color: var(--ink-2); }
.side .s-flat .chip { display: inline; white-space: nowrap; background: none; padding: 0; border-radius: 0; font-size: inherit; color: inherit; }
.side .s-flat .chip:not(:last-child)::after { content: '\00A0\00B7'; color: var(--rule-strong); font-weight: 400; }
.side .s-flat .chip.hi { background: none; color: var(--accent); font-weight: 600; }
.sheet-body.p1-main { padding: calc(5mm * var(--d)) 0 0 6.5mm; }

/* Continuation header */
.ch { flex: none; display: flex; justify-content: space-between; align-items: baseline; margin: 7mm var(--pad-x) var(--gap); padding-bottom: 2.4mm; border-bottom: .3mm solid var(--ink); }
.ch-name { font-size: 11pt; font-weight: 700; letter-spacing: -.02em; }
.ch-doc { font-size: 7.6pt; color: var(--ink-3); }

/* Section heading (kept with the block after it) */
.sec { font-size: calc(10pt * var(--d)); font-weight: 700; letter-spacing: -.01em; padding-bottom: calc(1.6mm * var(--d)); border-bottom: .3mm solid var(--ink); margin-bottom: calc(-1.2mm * var(--d)); }
.sec small { font-weight: 500; color: var(--ink-3); font-size: .82em; }

/* Profile */
.profile { font-family: var(--serif); font-size: calc(10.2pt * var(--d)); line-height: 1.5; color: var(--ink); }

/* Experience */
.exp-header { display: flex; justify-content: space-between; align-items: baseline; gap: 4mm; }
.exp-role { font-size: calc(10.4pt * var(--d)); font-weight: 650; letter-spacing: -.012em; line-height: 1.2; }
.exp-date { flex: none; font-size: 7.8pt; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-company { margin-top: .3mm; font-size: 8.4pt; font-weight: 500; color: var(--accent); }
.exp-promo-note { display: inline-block; margin-left: 2mm; font-size: 6.8pt; font-weight: 600; color: var(--accent); border: .25mm solid currentColor; border-radius: 1mm; padding: 0 1.2mm; vertical-align: .3mm; }
.exp-cont { font-size: 7.4pt; font-weight: 500; color: var(--ink-3); margin-left: 1.5mm; }
.exp-bullets { list-style: none; margin-top: calc(1.6mm * var(--d)); display: grid; gap: calc(.75mm * var(--d)); }
.exp-bullets li { position: relative; padding-left: 3.6mm; color: var(--ink-2); line-height: 1.38; }
.exp-bullets li::before { content: ''; position: absolute; left: 0; top: .62em; width: 1.8mm; height: .25mm; background: var(--accent); }
.exp-bullets strong { color: var(--ink); font-weight: 600; }
.tools { margin-top: calc(1.4mm * var(--d)); font-size: 7.4pt; line-height: 1.45; color: var(--ink-3); }
.tools b { font-weight: 600; color: var(--ink-2); }
.exp + .exp { padding-top: var(--gap); border-top: .2mm solid var(--rule); }

/* Ledger rows (earlier career, education) */
.rows { display: grid; }
.row { display: grid; grid-template-columns: 30mm 1fr auto; gap: 3mm; padding: calc(1.3mm * var(--d)) 0; border-bottom: .2mm solid var(--rule); align-items: baseline; }
.row .when { font-size: 7.6pt; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.row .what { font-weight: 600; }
.row .what small { display: block; margin-top: .4mm; font-weight: 400; color: var(--ink-2); font-size: 8pt; line-height: 1.4; }
.row .where { color: var(--accent); font-weight: 500; font-size: 8.2pt; text-align: right; }

/* Chips (certifications, skills) */
.chips { display: flex; flex-wrap: wrap; gap: 1.2mm; }
.chip { font-size: 7.4pt; line-height: 1.3; padding: .5mm 1.8mm; border-radius: 1mm; background: var(--sunk); color: var(--ink-2); }
.chip.hi { background: var(--accent); color: #fff; font-weight: 600; }
.chip.pro { background: #151515; color: #fff; font-weight: 600; }
.group-label { font-size: 7.6pt; font-weight: 600; color: var(--ink-3); margin-bottom: 1.2mm; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm 6mm; }
.more { margin-top: 1.2mm; font-size: 7.4pt; color: var(--ink-3); }
.more a { color: var(--accent); font-weight: 600; }

/* At a glance: three short sections side by side */
.glance { display: grid; grid-template-columns: 1.05fr 1fr 1.25fr; gap: 0 6mm; }
.glance .sec { margin-bottom: calc(2mm * var(--d)); }
.g-item { padding: calc(1mm * var(--d)) 0; border-bottom: .2mm solid var(--rule); }
.g-what { font-weight: 600; line-height: 1.3; }
.g-sub { font-size: 7.4pt; color: var(--ink-3); }
.glance .chip { font-size: 7pt; }

/* Additional, sign-off */
.additional p { color: var(--ink-2); margin-bottom: .8mm; }
.additional strong { color: var(--ink); font-weight: 600; }
.additional a { color: var(--accent); font-weight: 600; }
.sign-off { display: flex; justify-content: space-between; align-items: flex-end; gap: 6mm; padding-top: calc(3mm * var(--d)); border-top: .2mm solid var(--rule); }
.sign-off-quote { font-family: var(--serif); font-style: italic; font-size: 9.4pt; color: var(--ink-2); max-width: 120mm; line-height: 1.45; }
.sign-off-name { font-weight: 700; font-size: 10pt; text-align: right; }
.sign-off-sub { font-size: 7.4pt; color: var(--ink-3); text-align: right; }

@media print {
  @page { size: A4; margin: 0; }
  body { background: none; }
  .toolbar { display: none !important; }
  #pages { padding: 0; }
  .sheet { margin: 0; box-shadow: none; break-after: page; }
  .sheet:last-child { break-after: auto; }
}

@media screen and (max-width: 820px) {
  /* Phones get a scaled preview of the A4 pages */
  #pages { zoom: .45; }
}
