/* ============================================================
   Økvik Design — site.css
   Direction: white paper, one deep-blue statement band, EB Garamond
   throughout, IBM Plex Mono for metadata. Committed single (light) theme.
   ============================================================ */

/* ---- fonts (self-hosted, latin subset) ---- */
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/ebgaramond-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/ebgaramond-italic-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/plexmono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/plexmono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
ul { margin: 0; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* ---- tokens ---- */
:root {
  color-scheme: light;

  --paper: #ffffff;
  --ink: #1c2b34;
  --slate: #55656f;
  --faint: #8a969c;
  --line: #e3e8eb;
  --band: #2b4c68;
  --band-ink: #eaf1f5;
  --blue: #3a6285;
  --mist: #e9eef1;

  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --fs-meta: 0.78rem;
  --fs-sm: 0.95rem;
  --fs-body: 1.15rem;
  --fs-lead: 1.4rem;
  --fs-h3: 1.55rem;
  --fs-h2: 2.05rem;
  --fs-h1: clamp(2.3rem, 1.6rem + 3vw, 3.3rem);

  --measure: 40rem;    /* comfortable reading width for body text */
  --maxw: 1440px;      /* header, footer, the Design gallery */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --band-y: clamp(2.25rem, 4.5vw, 3.5rem);
  --section-y: clamp(2.5rem, 6vw, 4.25rem);
}

/* ---- base ---- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-body);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-wrap: break-word;
}
/* flex children must be allowed to shrink below their content's intrinsic width */
body > * { min-width: 0; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip:focus { left: 0; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
/* text-led pages: a centred reading column, narrower than the masthead */
.wrap--text { max-width: calc(var(--measure) + 2 * var(--gutter)); }
.wrap--text .prose,
.wrap--text .clients { max-width: none; }

/* ---- header ---- */
.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.4rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}
.brand img { width: 38px; height: 38px; }
.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.02rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.nav {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  font-size: 1rem;
}
.nav a {
  text-decoration: none;
  color: var(--slate);
  padding-block: 0.2rem;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--blue); border-bottom-color: currentColor; }

/* ---- statement band ---- */
.band { background: var(--band); color: var(--band-ink); }
.band > .wrap { padding-block: var(--band-y); text-align: center; }
.band p {
  margin: 0 auto;
  max-width: 26rem;
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.6rem);
  line-height: 1.4;
  font-weight: 500;
  text-wrap: balance;
}
.band .kicker {
  display: block;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.72;
}

/* ---- sections & headings ---- */
main { flex: 1 0 auto; }
.section { padding-block: var(--section-y); }
.section + .section { border-top: 1px solid var(--line); }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 1rem;
}
h1 {
  font-size: var(--fs-h1);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: 0.005em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h2 {
  font-size: var(--fs-h2);
  line-height: 1.15;
  font-weight: 500;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h3 {
  font-size: var(--fs-h3);
  line-height: 1.2;
  font-weight: 600;
  margin: 2rem 0 0.5em;
}

/* ---- prose ---- */
.prose { max-width: var(--measure); }
.prose > * { margin-block: 0; }
.prose > * + * { margin-top: 1.9em; }
.prose > .lead + * { margin-top: 1.3em; }
.prose a { color: var(--blue); text-underline-offset: 3px; }
.lead {
  font-size: var(--fs-lead);
  line-height: 1.45;
}

/* ---- home: approach block ---- */
.approach { display: block; }

/* ---- cover grid (Design page) ---- */
.covers {
  display: grid;
  gap: clamp(1.1rem, 2.2vw, 2rem);
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 620px)  { .covers { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .covers { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1560px) { .covers { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 340px)  { .covers { grid-template-columns: 1fr; } }

.work { margin: 0; }
.work-cap {
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.work-title { font-size: 1.05rem; }
.work-cat {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
/* on the Design grid the tile is purely visual (image or tint); all text
   lives in the caption below */
.work .cover .ct,
.work .cover .cs { display: none; }
.work.is-interactive { cursor: pointer; }
.work.is-interactive .cover { transition: transform 0.2s ease; }
.work.is-interactive:hover .cover { transform: translateY(-3px); }
.work.is-interactive:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }

/* ---- cover cluster (Home) ---- */
.covers--home {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  max-width: 560px;
}
.cover-link {
  display: block;
  width: clamp(96px, 26vw, 112px);
  text-decoration: none;
  transition: transform 0.2s ease;
}
.cover-link:hover { transform: translateY(-3px); }
/* tiny thumbnails fill their tile (uniform grid); the big Design grid uses contain */
.covers--home .cover-img { object-fit: cover; }
.covers--home .cover { padding: 0.65rem 0.6rem; }
.covers--home .cover .ct,
.covers--home .cover .cs { display: none; }

.cover {
  position: relative;
  aspect-ratio: 1 / 1.42;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1rem;
  background: var(--c, #dbe6ee);
  color: var(--cfg, #25323c);
  text-decoration: none;
}
.cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* neutral ground behind a real cover (covers vary slightly in proportion) */
.cover:has(.cover-img) { background: #f1f3f4; }
.cover .ct {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.15;
}
.cover .cs {
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ---- cover detail dialog (§5) ---- */
.cover-dialog {
  padding: 0;
  border: none;
  max-width: min(860px, 92vw);
  width: 100%;
  max-height: 92vh;
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(15, 25, 32, 0.5);
}
.cover-dialog::backdrop { background: rgba(28, 43, 52, 0.66); }
.cd-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 1fr;
}
.cd-figure {
  position: relative;
  background: #f1f3f4;
  color: var(--cfg, #25323c);
  display: grid;
  place-items: center;
  overflow: hidden;
}
/* the panel takes the cover's own shape — no letterboxing */
.cd-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 84vh;
  object-fit: contain;
}
.cd-ph {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  text-align: center;
  padding: 5rem 2rem;
}
.cd-meta { padding: clamp(1.5rem, 4vw, 2.5rem); align-self: center; }
.cd-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 1rem;
}
.cd-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1.2rem;
  margin: 0 0 1.2rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.cd-facts dt { color: var(--faint); }
.cd-facts dd { margin: 0; }
.cd-note { margin: 0; color: var(--slate); }

.cd-close {
  position: absolute;
  z-index: 1;
  top: 0.6rem;
  right: 0.6rem;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 1.4rem;
  cursor: pointer;
}
.cd-close:hover { background: #fff; }

/* prev / next live in the meta panel, in flow — never over the artwork */
.cd-nav { display: flex; gap: 0.6rem; margin-top: 1.75rem; }
.cd-arrow {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.05rem;
  cursor: pointer;
}
.cd-arrow:hover { border-color: var(--ink); }

@media (max-width: 640px) {
  .cd-inner { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .work.is-interactive .cover,
  .cover-link { transition: none; }
}

.caption {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}
.caption a { color: var(--blue); text-decoration: none; }
.caption a:hover { text-decoration: underline; }

/* ---- clients list ---- */
.clients {
  columns: 2;
  column-gap: 2.5rem;
  max-width: var(--measure);
  font-size: var(--fs-sm);
  list-style: none;
}
.clients li { margin-bottom: 0.35rem; break-inside: avoid; }

/* ---- contact ---- */
.contact-details {
  margin: 2rem 0 0;
  display: grid;
  gap: 1rem;
}
.contact-details > div {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.5rem 1rem;
}
.contact-details dt {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 0.15rem;
}
.contact-details dd { margin: 0; font-size: var(--fs-lead); line-height: 1.4; }
.contact-details a { color: var(--blue); text-decoration: none; }
.contact-details a:hover { text-decoration: underline; }
@media (max-width: 460px) {
  .contact-details > div { grid-template-columns: 1fr; gap: 0.15rem; }
  .contact-details dd { font-size: 1.15rem; }
}

/* ---- footer ---- */
.site-foot { border-top: 1px solid var(--line); margin-top: var(--section-y); }
.site-foot > .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  padding-block: 2rem;
  font-size: var(--fs-sm);
  color: var(--faint);
}
.site-foot a { text-decoration: none; color: var(--faint); }
.site-foot a:hover { color: var(--ink); }
.site-foot .nav { font-size: var(--fs-sm); gap: 1.2rem; }
.site-foot .nav a { color: var(--faint); }

/* ---- responsive ---- */
@media (max-width: 620px) {
  .site-head { flex-direction: column; gap: 0.9rem; text-align: center; }
  .nav { gap: 1.1rem; font-size: 0.95rem; }
  .clients { columns: 1; }
}

/* ---- admin (§6+) ---- */
.admin { background: var(--mist); display: block; }
.admin-auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2rem;
  text-align: center;
}
.admin-auth img { margin-bottom: 0.5rem; }
.admin-auth h1 {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 1.5rem;
}
.admin-auth form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 20rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: left;
}
.admin-auth label {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.admin input[type="password"],
.admin input[type="text"],
.admin textarea {
  font: inherit;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
.admin button {
  font: inherit;
  cursor: pointer;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--band);
  border-radius: 6px;
  background: var(--band);
  color: #fff;
}
.admin button:hover { background: #23415c; }
.admin-error {
  margin: 0;
  color: #a3341f;
  font-size: var(--fs-sm);
}
.admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.admin-bar-title {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.admin-bar-actions { display: flex; align-items: center; gap: 1rem; }
.admin-bar-actions a { color: var(--blue); text-decoration: none; font-size: var(--fs-sm); }
.admin-bar-actions form { margin: 0; }
.admin-bar button { padding: 0.4rem 0.8rem; font-size: var(--fs-sm); }
.admin-main {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem);
}
.admin-loading { color: var(--faint); }
.admin-group { margin-bottom: 2.5rem; }
.admin-group h2 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.field { margin-bottom: 1.4rem; display: flex; flex-direction: column; gap: 0.4rem; }
.field label {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.field textarea { resize: vertical; min-height: 2.6rem; line-height: 1.5; }
.field-hint { margin: 0; font-size: var(--fs-sm); color: var(--faint); }
.admin-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1rem 0;
  background: var(--mist);
  border-top: 1px solid var(--line);
}
.admin-actions button:disabled { opacity: 0.6; cursor: default; }
.save-status { font-size: var(--fs-sm); color: var(--faint); }
.save-status.is-ok { color: #2c6b3f; }
.save-status.is-error { color: #a3341f; }

/* admin tabs */
.admin-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.admin-tabs button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--slate);
  padding: 0.5rem 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.admin-tabs button.is-active { color: var(--ink); border-bottom-color: var(--band); }

/* covers editor */
.cover-rows { display: flex; flex-direction: column; gap: 0.9rem; }
.cover-row {
  display: grid;
  grid-template-columns: auto 56px 1fr;
  gap: 0.8rem;
  align-items: start;
  padding: 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.cover-row.dragging { opacity: 0.5; }
.drag-handle {
  cursor: grab;
  color: var(--faint);
  font-size: 1.1rem;
  line-height: 1.4;
  user-select: none;
  padding-top: 0.2rem;
}
.cover-thumb {
  width: 56px;
  aspect-ratio: 1 / 1.42;
  border-radius: 3px;
  overflow: hidden;
  background: var(--mist);
  position: relative;
}
.cover-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cover-thumb.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
}
.cover-fields { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.cover-fields input,
.cover-fields textarea {
  font: inherit;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
}
.cover-fields textarea { resize: vertical; line-height: 1.5; }
.cover-fields-row { display: flex; gap: 0.5rem; }
.cover-fields-row input { flex: 1; }
.cover-controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.2rem;
}
.cover-controls button {
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
}
.cover-controls button:disabled { opacity: 0.4; cursor: default; }
.cover-featured {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-sm);
  color: var(--slate);
  cursor: pointer;
  margin-left: auto;
}
.cover-controls .cover-remove { color: #a3341f; border-color: #e2c4bd; }
.cover-add {
  font: inherit;
  cursor: pointer;
  margin: 1rem 0 0;
  padding: 0.55rem 1rem;
  border: 1px dashed var(--slate);
  border-radius: 6px;
  background: none;
  color: var(--slate);
}
.cover-add:hover { color: var(--ink); border-color: var(--ink); }

@media (max-width: 560px) {
  .cover-row { grid-template-columns: auto 48px 1fr; }
  .cover-fields-row { flex-wrap: wrap; }
}

/* history */
.snap-list { list-style: none; margin: 1.5rem 0 0; }
.snap-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.snap-time { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.snap-label { flex: 1; color: var(--faint); font-family: var(--mono); font-size: var(--fs-meta); }
.snap-list button {
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
}
.snap-list button:hover { border-color: var(--ink); }
