/*
 * Heritage theme. Structure follows the Jcorp Mk4 theme (jcorp-nomad-push master.css):
 * sticky 64px header with a logo chip, 10–12px radius cards that lift on hover, tiles with a
 * press-down, the same shadow and easing tokens. Colours are a warm paper palette instead of
 * Jcorp blue; the navy Jcorp tree stays as the mark.
 */

@font-face { font-family: "Fira Sans"; font-weight: 400; font-display: swap; src: url("../fonts/fira-sans-400.d26e1b11589f.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-display: swap; src: url("../fonts/fira-sans-500.9410bb8f89e5.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 600; font-display: swap; src: url("../fonts/fira-sans-600.beb3d7395726.woff2") format("woff2"); }
@font-face { font-family: "Roboto Slab"; font-weight: 500; font-display: swap; src: url("../fonts/roboto-slab-500.4b6983d51f3a.woff2") format("woff2"); }
@font-face { font-family: "Roboto Slab"; font-weight: 700; font-display: swap; src: url("../fonts/roboto-slab-700.9b677cb044d5.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-display: swap; src: url("../fonts/source-serif-4-400.95bbd98f2b3c.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/source-serif-4-400-italic.fa10869cc45e.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-display: swap; src: url("../fonts/source-serif-4-600.beb0c8d8bee8.woff2") format("woff2"); }

:root {
  --jcorp-navy: #223e87;

  --bg: #f6efe3;
  --card: #fffaf2;
  --card-border: #e6d8c2;
  --line: rgba(74, 52, 38, 0.10);
  --text: #3a2e24;
  --muted: #7b6a58;
  --primary: #9a5b34;
  --primary-dark: #7a4526;
  --primary-soft: #f1e1cf;
  --header-bg: #4a3426;
  --header-text: #f6efe3;
  --chip-bg: #f6efe3;
  --mark: var(--jcorp-navy);
  --danger: #a3362a;
  --success: #4f6b3a;
  --focus: #223e87;

  --font-ui: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: "Roboto Slab", Georgia, serif;
  --font-prose: "Source Serif 4", Georgia, "Times New Roman", serif;

  --radius: 10px;
  --radius-small: 6px;
  --radius-large: 12px;
  --shadow: 0 6px 18px rgba(58, 40, 24, 0.08);
  --shadow-large: 0 12px 36px rgba(58, 40, 24, 0.12);
  --header-height: 64px;
  --page-max: 1100px;
  --ease-out: cubic-bezier(.2, .9, .2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1814;
    --card: #28211b;
    --card-border: #3b3128;
    --line: rgba(241, 231, 216, 0.08);
    --text: #f1e7d8;
    --muted: #b8a690;
    --primary: #d39a6a;
    --primary-dark: #e5b48a;
    --primary-soft: #3a2c21;
    --header-bg: #2a1f17;
    --header-text: #f1e7d8;
    --chip-bg: #f1e7d8;
    --mark: #5789ca; /* Jcorp dark-lockup tree colour */
    --danger: #e0806f;
    --success: #9cbf7d;
    --focus: #8fb0ff;
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadow-large: 0 12px 36px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.55;
}

a { color: var(--primary-dark); text-underline-offset: 0.15em; }
a:hover { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

/* ---- Header (Mk4: sticky, 64px, logo chip) ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-height);
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: var(--shadow);
}
.site-header .inner {
  max-width: var(--page-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand:hover { color: inherit; }
.logo-chip {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--chip-bg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
}
.mark {
  display: block;
  width: 22px;
  aspect-ratio: 522 / 692;
  background: var(--mark);
  -webkit-mask: url("../img/logo.ec1dc50cccdf.png") center / contain no-repeat;
  mask: url("../img/logo.ec1dc50cccdf.png") center / contain no-repeat;
}
.logo-chip .mark { background: var(--jcorp-navy); }
.brand-name {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a, .site-nav button {
  color: var(--header-text);
  text-decoration: none;
  font: 500 0.95rem var(--font-ui);
  padding: 8px 12px;
  border-radius: var(--radius-small);
  background: none;
  border: 0;
  cursor: pointer;
}
.site-nav a:hover, .site-nav button:hover { background: rgba(255, 255, 255, 0.10); }
.site-nav form { margin: 0; }

/* ---- Layout ---- */
main {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px 16px 48px;
}
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}
.site-footer .inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-footer .mark { width: 12px; background: var(--muted); }

.narrow { max-width: 460px; margin: 0 auto; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }

/* ---- Cards and tiles (Mk4 shapes) ---- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-large);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-large); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .1s var(--ease-out);
}
.tile:hover { color: var(--primary-dark); }
.tile:active { transform: translateY(1px); }

/* ---- Prose (articles) ---- */
.prose { font-family: var(--font-prose); font-size: 1.15rem; line-height: 1.7; max-width: 68ch; }
.prose p { margin: 0 0 1em; }

/* ---- Forms ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.field .errors { color: var(--danger); font-size: 0.95rem; margin: 6px 0 0; padding: 0; list-style: none; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-small);
  padding: 10px 12px;
  min-height: 46px;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--primary);
  color: #fffaf2;
  font: 600 1rem var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .1s var(--ease-out), background .2s;
}
.btn:hover { background: var(--primary-dark); color: #fffaf2; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--card); color: var(--text); border-color: var(--card-border); }
.btn.secondary:hover { background: var(--primary-soft); }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: 0.9rem; }
.btn.block { width: 100%; }
@media (prefers-color-scheme: dark) {
  .btn, .btn:hover { color: #1d1814; }
  .btn.secondary, .btn.secondary:hover { color: var(--text); }
}

/* ---- Messages ---- */
.messages { list-style: none; margin: 0 0 24px; padding: 0; }
.messages li {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  border: 1px solid var(--card-border);
}
.messages li.error { border-color: var(--danger); }
.messages li.success { border-color: var(--success); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.pill.accepted { color: var(--success); }
.pill.revoked, .pill.expired { color: var(--muted); }

.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-family: ui-monospace, monospace; font-size: 0.9rem; }

/* ---- Sign-in page ---- */
.auth-mark { display: flex; justify-content: center; margin-bottom: 16px; }
.auth-mark .mark { width: 48px; }
.auth-title { text-align: center; }

@media (max-width: 560px) {
  .brand-name { font-size: 1.05rem; }
  .site-nav a, .site-nav button { padding: 8px; }
  .site-nav .wide-only { display: none; }
  main { padding-top: 24px; }
  .copy-row { flex-direction: column; }
}

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