/* CNL tools — shared styling.
   Tokens live at :root and match the CNL brand CSS used on chapter pages
   (chapter-dashboard/chapter.css). Tools may add a tool.css but should build
   on these. The landing page (index.html) and the tool-page chrome
   (assets/shell.js) both draw from this one file, so they cannot drift. */

/* Brand fonts. Typekit kit kxb6xor serves pragmatica-extended (display) and
   ff-tisa-web-pro (serif); the kit's domain allowlist must include the host
   this site runs on. Google Fonts supplies the free fallbacks: Domine for
   the serif, Archivo (wide) for the display face. */
@import url("https://use.typekit.net/kxb6xor.css");
@import url("https://fonts.googleapis.com/css2?family=Domine:wght@400;700&family=Archivo:wdth,wght@125,700..900&display=swap");

:root {
  /* brand */
  --navy: #2C3659;
  --red: #9F3C39;
  --cream: #FDFBE9;
  /* (the brand yellow/blue accents are intentionally unused here) */

  --ink: var(--navy);
  --bg: var(--cream);
  --muted: rgba(44, 54, 89, 0.72);       /* warm gray for secondary text */
  --rule: rgba(44, 54, 89, 0.2);         /* hairlines */
  --rule-strong: rgba(44, 54, 89, 0.35); /* dashed ghost slot */
  --on-navy-muted: rgba(253, 251, 233, 0.6);
  --field-bg: #fff;

  --font-display: pragmatica-extended, Archivo, "Arial Black", sans-serif;
  --font-serif: ff-tisa-web-pro, Domine, Georgia, "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* spacing scale 4/8/12/16/24/32 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;

  --radius-card: 12px;
  --card-shadow: 5px 5px 0 var(--navy);
  --card-shadow-hover: 6px 6px 0 var(--navy);
  --btn-shadow: 3px 3px 0 var(--red);

  --rail-w: 260px;
  --max-w: 64rem;
  --pad: 22px;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--navy); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover { color: var(--red); }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}
.rail :focus-visible,
.shell-header :focus-visible { outline-color: var(--cream); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Display face: heavy wide sans, all caps, tracked out. */
.disp {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* Logo mark: the half-globe from the CNL logo, inline SVG over currentColor
   so it works on navy and cream. Tall glyph (~1:2), so size by height. */
.mark {
  display: inline-block;
  height: 22px;
  width: auto;
  aspect-ratio: 244 / 471;
  flex: none;
  vertical-align: -5px;
}
.mark svg { display: block; width: 100%; height: 100%; }

/* ---------- components ---------- */

/* Status pill (landing cards): outline style. Text label always present. */
.pill {
  display: inline-block;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.pill--draft { color: var(--muted); border-color: var(--rule-strong); border-style: dashed; }

/* Status chip (tool bar): solid red. */
.chip {
  display: inline-block;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--cream);
  background: var(--red);
  border-radius: 3px;
  padding: 3px 8px;
  white-space: nowrap;
}

/* Primary button: navy, square corners, hard red offset shadow.
   Press = stamp: moves into its shadow. Works on <a>, <button>, and <span>. */
.button {
  display: inline-block;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--cream);
  background: var(--navy);
  border: 0;
  border-radius: 0;
  padding: 8px 14px;
  box-shadow: var(--btn-shadow);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}
.button:hover { color: var(--cream); box-shadow: 4px 4px 0 var(--red); }
.button:active,
.button.is-pressed {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--red);
}
.button:disabled, .button[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* Card surface: the signature device. Cream, red border, hard navy shadow. */
.card,
.panel {
  background: var(--bg);
  border: 2px solid var(--red);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  margin-right: 6px;
  margin-bottom: 6px;
}
.panel { padding: var(--s5) var(--pad); }

/* ---------- landing page: rail + content ---------- */

body.landing {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  align-items: start;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  background: var(--navy);
  color: var(--cream);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.rail a { color: var(--cream); }
.rail a:hover { color: var(--cream); text-decoration-thickness: 2px; }

.rail__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  text-decoration: none;
  min-height: 44px;
  font-size: 13px;
  letter-spacing: 0.18em;
}
.rail__brand:hover { text-decoration: none; }

.rail__title {
  margin: 0;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 900;
  font-size: 30px;
  line-height: 0.98;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--cream);
}

.rail__intro {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.rail__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.rail__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
}

.rail__updated {
  margin-top: auto;
  padding-top: var(--s4);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--on-navy-muted);
}

.content {
  min-height: 100vh;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 800px;
}

.tool-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Tool card: the whole card is the link. */
.tool-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s4) var(--s5);
  align-items: stretch;
  padding: 18px 20px;
  background: var(--bg);
  border: 2px solid var(--red);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  margin-right: 6px;
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}
.tool-card:hover,
.tool-card:focus-visible {
  color: var(--ink);
  box-shadow: var(--card-shadow-hover);
  transform: translate(-1px, -1px);
}
.tool-card:active { transform: none; box-shadow: var(--card-shadow); }
.tool-card:active .button { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--red); }
.tool-card:hover .button { box-shadow: 4px 4px 0 var(--red); }

.tool-card__title {
  margin: 0 0 var(--s1);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.25;
}
.tool-card__blurb {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 380px;
}
.tool-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s3);
}

/* Ghost slot: static last item; also the failure state. Not a link. */
.ghost-slot {
  border: 2px dashed var(--rule-strong);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  margin-right: 6px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
}
.ghost-slot a { color: var(--red); }

.content__footer {
  margin-top: auto;
  padding-top: var(--s5);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
  font-size: 10.5px;
  color: var(--muted);
}
.content__footer a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.content__footer a:hover { color: var(--red); }

/* ---------- tool pages: bar + footer (rendered by shell.js) ---------- */

.shell-header {
  background: var(--navy);
  color: var(--cream);
}
.shell-header__inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2) 14px;
  padding: 12px var(--pad);
  min-height: 44px;
}
.shell-header a { color: var(--cream); }
.shell-header a:hover { color: var(--cream); text-decoration-thickness: 2px; }
.shell-header__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  min-height: 44px;
}
.shell-header__title {
  margin: 0;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream);
  line-height: 1.3;
}
.shell-header__back {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 10.5px;
  white-space: nowrap;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s5) var(--pad) var(--s6);
}

.shell-footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
}
.shell-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  align-items: center;
  padding: 12px var(--pad) 16px;
  font-size: 10.5px;
}
.shell-footer p { margin: 0; }
.shell-footer a { color: var(--muted); display: inline-flex; align-items: center; min-height: 44px; }
.shell-footer a:hover { color: var(--red); }

/* ---------- forms & buttons (shared defaults for tools) ---------- */

label,
legend {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.field { margin-bottom: 1rem; }
.field .hint,
.hint {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
}

input[type="text"], input[type="email"], input[type="url"], input[type="date"],
input[type="time"], input[type="number"], input[type="search"],
select, textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--field-bg);
  border: 1.5px solid var(--navy);
  border-radius: 0;
  padding: 0.55rem 0.65rem;
  width: 100%;
  max-width: 100%;
}
textarea { min-height: 7rem; resize: vertical; }

/* Bare <button> gets the navy/square look without the shadow, so tools that
   style their own buttons don't inherit a shadow they didn't ask for.
   Add class="button" for the full primary treatment. */
button {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cream);
  background: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 0;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  line-height: 1.3;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
.button--secondary, button.button--secondary {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  box-shadow: none;
}
.button--secondary:hover { background: var(--navy); color: var(--cream); }

/* Placeholder notice used by tool stubs. */
.notice {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  border: 1.5px dashed var(--red);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  margin: 1rem 0;
  background: rgba(159, 60, 57, 0.06);
}
.notice strong { color: var(--red); }

/* ---------- embed mode: tool body only ---------- */

body.is-embedded { background: transparent; }
.is-embedded .site-main {
  max-width: none;
  padding: 0.5rem 0.5rem calc(0.5rem + 6px);
}

/* ---------- small screens ---------- */

@media (max-width: 700px) {
  body.landing { display: block; }
  .rail {
    position: static;
    height: auto;
    padding: var(--s5) 24px;
  }
  .rail__updated { margin-top: var(--s2); }
  .content { min-height: 0; padding: var(--s5) 24px; max-width: none; }
  .tool-card { grid-template-columns: minmax(0, 1fr); }
  .tool-card__side {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
  }
}

@media (max-width: 480px) {
  :root { --pad: 16px; }
  .shell-header__back { margin-left: 0; }
  .panel { padding: 1rem 0.9rem; }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .tool-card:hover, .tool-card:focus-visible { transform: none; }
}
