/* ==========================================================================
   corporate-site-demo — nord theme
   palette uses the exact nord hex values from docs/build-spec.md.
   ========================================================================== */

:root {
  /* ===== icy palette =====
     ground/surface/hairline, accents, and text. every text and accent pair
     below meets wcag aaa against --nord0; --nord11 is aa (it is a danger
     colour used for short labels, not body copy). */
  --nord0: #0e1720;   /* deep fjord   - ground */
  --nord1: #16232e;   /* slate ice    - surface */
  --nord2: #1e2e3b;   /* raised ice   - raised surface */
  --nord3: #2c4152;   /* ice edge     - hairline, decorative only */

  --nord4: #9fb4c1;   /* mist         - text muted   8.41:1 aaa */
  --nord5: #c8d9e3;   /* frost soft   - text soft   12.47:1 aaa */
  --nord6: #e6f0f5;   /* frost white  - text        15.62:1 aaa */

  --nord7: #97e4cb;   /* snowflake spark - accent 2 12.28:1 aaa */
  --nord8: #4ad1f5;   /* glacier pulse   - accent   10.09:1 aaa */
  --nord9: #2e9dbb;   /* glacier deep    - accent deep 5.73:1 aa */
  --nord10: #1f6f86;  /* glacier dusk    - accent dark, fills only */

  --nord11: #e06c75;  /* danger  - short labels only, aa */
  --nord12: #d08770;  /* warm accent (unchanged, sparing use) */
  --nord13: #ebcb8b;  /* warm attention (unchanged) */
  --nord14: #7fc8a9;  /* success 9.24:1 aaa */
  --nord15: #b48ead;  /* reserved */

  --max-width: 1320px;
  --radius: 10px;
  --font-sans: "roboto", system-ui, -apple-system, "segoe ui", sans-serif;
  --font-mono: ui-monospace, "sf mono", "cascadia mono", menlo, consolas,
    "liberation mono", monospace;
}

@font-face {
  font-family: "roboto";
  src: url("../fonts/roboto-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--nord0);
  color: var(--nord4);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizelegibility;
}

h1, h2, h3, h4 {
  color: var(--nord5);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

a {
  color: var(--nord8);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover { color: var(--nord7); }

img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* -------------------------------------------------------------------------
   header / nav
   ------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14, 23, 32, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--nord2);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--nord6);
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 40px;
  height: 40px;
  flex: none;
}

/* Live text rather than a scaled-down lockup image: the lockup's minimum
   legible height is ~120px, so at header size it must be set as type. */
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-line1 {
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--nord6);
}

.brand-line2 {
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--nord4);
  margin-top: 2px;
}

/* (brand sizing is handled in the 620px block; a 720px block used to
   re-enlarge it afterwards and win the cascade.) */

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav a {
  color: var(--nord4);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav a:hover,
.nav a.is-active { color: var(--nord8); }

/* -------------------------------------------------------------------------
   hero / header bands
   ------------------------------------------------------------------------- */
.hero,
.page-hero {
  position: relative;
  /* Content-sized, not viewport-sized. 72vh reserved most of a screen for a
     headline and one paragraph; the photo still reads at this height. */
  min-height: 0;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--nord6);
}

/* Page banner for inner pages. These pages carry only a short title, never a
   lead paragraph or call-to-action, so a photo hero at 42vh spent most of a
   screen on two words. This is a compact banner instead: enough image to keep
   the identity, sized to the type rather than to the viewport. */
.page-hero {
  position: relative;
  min-height: 0;
  padding: 2.6rem 0 2.4rem;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--nord6);
}

.page-hero h1 {
  font-size: clamp(1.65rem, 2.6vw, 2.15rem);
  margin: 0;
}

.hero::before,
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
}

.hero > .container,
.page-hero > .container {
  position: relative;
  z-index: 1;
}

/* On wide screens the hero copies sit in a deliberate left rail rather than
   spilling into the photo. The right-hand space carries the image. */
.hero > .container {
  max-width: var(--max-width);
  padding-top: 3.2rem;
  padding-bottom: 3.2rem;
}

@media (min-width: 820px) {
  .hero > .container {
    display: block;
    max-width: var(--max-width);
  }

  /* The headline reads as one line: the phrase is ~27 characters, and the old
     18-22ch caps forced it onto two. `nowrap` is deliberately not used - at
     narrow widths the line must still be allowed to break. */
  .hero .hero-copy > h1 { max-width: none; }
  .hero .hero-copy > p  { max-width: 68ch; }
  .hero .hero-copy > .hero-cta { max-width: none; }
}

.hero h1,
.page-hero h1 {
  color: var(--nord6);
  /* No ch cap: the hero phrase fits one line where there is room, and wraps
     naturally where there is not. Page banners keep their own narrower width. */
  max-width: none;
  text-shadow: 0 2px 18px rgba(14, 23, 32, 0.7);
  text-wrap: balance;
}

.page-hero h1 {
  max-width: 24ch;
}

.hero p.lead {
  font-size: 1.15rem;
  max-width: 46ch;
  color: var(--nord5);
}

.hero-cta {
  margin-top: 1.6rem;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* -------------------------------------------------------------------------
   buttons
   ------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  text-align: center;
}

.btn-primary {
  background: var(--nord8);
  color: var(--nord0);
}

.btn-primary:hover {
  background: var(--nord7);
  color: var(--nord0);
}

.btn-ghost {
  background: transparent;
  color: var(--nord6);
  border-color: var(--nord3);
}

.btn-ghost:hover {
  border-color: var(--nord8);
  color: var(--nord8);
}

/* -------------------------------------------------------------------------
   sections / bands
   ------------------------------------------------------------------------- */
.section {
  padding: 44px 0;
}

.section-alt {
  background: var(--nord1);
}

/* The index heading sits on the same left edge as the hero copy above it and
the entries below it. Centring it made the list look misaligned against the
hero, which is left-aligned. */
.section-head {
  max-width: 76ch;
  margin: 0 0 6px;
  text-align: left;
}

.section-head p { color: var(--nord4); margin-bottom: 0; }

/* -------------------------------------------------------------------------
   forms
   ------------------------------------------------------------------------- */
.form-card {
  max-width: 520px;
  margin: 0 auto;
  background: var(--nord1);
  border: 1px solid var(--nord2);
  border-radius: var(--radius);
  padding: 32px;
}

.form-card label {
  display: block;
  margin-bottom: 6px;
  color: var(--nord5);
  font-weight: 500;
  font-size: 0.92rem;
}

.form-card input,
.form-card textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--nord0);
  border: 1px solid var(--nord2);
  border-radius: 8px;
  color: var(--nord6);
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 18px;
  transition: border-color 0.15s ease;
}

.form-card input:focus,
.form-card textarea:focus {
  outline: none;
  border-color: var(--nord8);
}

.form-card textarea { resize: vertical; min-height: 140px; }

.form-card .btn { width: 100%; }

.form-note {
  text-align: center;
  color: var(--nord4);
  font-size: 0.88rem;
  margin-top: 16px;
}

.form-error {
  display: none;
  background: rgba(224, 108, 117, 0.12);
  border: 1px solid var(--nord11);
  color: var(--nord11);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.form-success {
  display: none;
  background: rgba(127, 200, 169, 0.12);
  border: 1px solid var(--nord14);
  color: var(--nord14);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* honeypot: hidden from humans */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* -------------------------------------------------------------------------
   article / prose
   ------------------------------------------------------------------------- */
/* A narrower measure than the page container: prose is read, not scanned.
   68ch at the base size is the widest that still holds a comfortable line
   count without the eye losing its place on the return sweep. */
.prose {
  max-width: 68ch;
  color: var(--nord5);
}

.prose > :first-child { margin-top: 0; }

.prose h2 {
  margin-top: 2em;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
}

.prose h3 {
  margin-top: 1.8em;
  font-size: 1.1rem;
  color: var(--nord6);
}

.prose p,
.prose li {
  font-size: 1.0625rem;
  line-height: 1.7;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 0 0 1.2em;
}

.prose li { margin-bottom: 0.4em; }

.prose li::marker { color: var(--nord9); }

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--nord10);
  text-underline-offset: 3px;
}

.prose a:hover { text-decoration-color: var(--nord7); }

.prose strong { color: var(--nord6); font-weight: 600; }

.prose blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--nord9);
  color: var(--nord4);
}

.prose blockquote p { margin: 0; }

.prose hr {
  border: 0;
  border-top: 1px solid var(--nord2);
  margin: 2.4em 0;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Inline code sits on the text baseline inside a paragraph, so it gets a
   tinted chip rather than a block. */
.prose :not(pre) > code {
  background: var(--nord2);
  color: var(--nord6);
  padding: 2px 5px;
  border-radius: 4px;
}

/* Fenced blocks scroll rather than wrap: wrapping source code destroys the
   indentation the reader is looking for. */
.prose pre {
  margin: 0 0 1.4em;
  padding: 14px 16px;
  background: var(--nord1);
  border: 1px solid var(--nord2);
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.55;
}

.prose pre code {
  background: none;
  padding: 0;
  color: var(--nord5);
  font-size: 0.875rem;
}

/* -------------------------------------------------------------------------
   blog index
   ------------------------------------------------------------------------- */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Hairlines between entries, none above the first: the list reads as one
   continuous block rather than a set of cards. */
.post-item {
  border-top: 1px solid var(--nord2);
  padding: 24px 0;
}

.post-item:first-child { border-top: 0; padding-top: 4px; }

.post-item h2 {
  margin: 0 0 6px;
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
}

.post-item h2 a { color: var(--nord6); }

.post-item h2 a:hover { color: var(--nord8); }

.post-meta {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--nord4);
}

.post-meta a { color: var(--nord9); }

.post-summary {
  margin: 10px 0 0;
  color: var(--nord4);
  max-width: 72ch;
}

.post-empty {
  text-align: center;
  color: var(--nord4);
  padding: 24px 0;
}

/* Tags under an article. Quiet: they are metadata, not navigation. */
.post-tags {
  margin-top: 2.6em;
  padding-top: 20px;
  border-top: 1px solid var(--nord2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--nord9);
  border: 1px solid var(--nord10);
  border-radius: 999px;
  padding: 3px 11px;
}

/* The post page sets its date above the title, inside the banner. */
.page-hero .post-meta {
  color: var(--nord4);
  margin-bottom: 10px;
}

.page-hero .post-meta a { color: var(--nord8); }

/* -------------------------------------------------------------------------
   footer
   ------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--nord2);
  padding: 48px 0;
  background: var(--nord1);
}

.site-footer .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.site-footer h4 { color: var(--nord6); margin-bottom: 0.5em; }

.site-footer p,
.site-footer li {
  color: var(--nord4);
  font-size: 0.92rem;
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li { margin-bottom: 6px; }

.footer-credits {
  grid-column: 1 / -1;
  border-top: 1px solid var(--nord2);
  padding-top: 20px;
  font-size: 0.82rem;
  color: var(--nord3);
}

/* -------------------------------------------------------------------------
   responsive (one breakpoint)
   ------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .site-footer .container { grid-template-columns: 1fr; }
  .site-header .container { height: auto; padding-top: 12px; padding-bottom: 12px; flex-direction: column; gap: 10px; }
  .nav { flex-wrap: wrap; justify-content: center; }
}

/* ---------------------------------------------------------------------------
   Dense layout for the sizes people actually use: a 1080p window, or a single
   tile of a 4K screen (~960x1080). Vertical budget matters more than width
   here, so padding is trimmed and the copy is allowed a wider measure that
   wraps into fewer lines.
   ------------------------------------------------------------------------- */
@media (min-width: 820px) and (max-height: 1100px) {
  .hero > .container {
    padding-top: 2.2rem;
    padding-bottom: 2.2rem;
  }

  /* Wider measure = fewer lines = a shorter hero. 52ch at 18.4px wraps this
     paragraph to 5 lines; 62ch brings it to 4. */
  .hero .hero-copy > p { max-width: 62ch; }

  .section { padding: 36px 0; }
  .section-head { margin-bottom: 22px; }
  .post-item { padding: 18px 0; }
}

@media (min-width: 820px) and (max-height: 900px) {
  .hero > .container { padding-top: 1.6rem; padding-bottom: 1.6rem; }
  .hero h1 { font-size: clamp(1.8rem, 3.4vw, 2.3rem); }
  .section { padding: 30px 0; }
}

/* ---------------------------------------------------------------------------
   Primary target: a Chromium --app window on a 1080p panel.
   An --app window has no tab strip or URL bar, so its viewport is the panel
   height minus the desktop panel - about 1000px at 100%, and 728-864px when
   the panel runs at 125-150% scaling. The rules below size the hero to leave
   the first content section visible on the same screen where possible.
   ------------------------------------------------------------------------- */
@media (min-width: 820px) and (max-height: 1040px) {
  .hero > .container { padding-top: 1.9rem; padding-bottom: 1.9rem; }
  .hero h1 { font-size: clamp(1.75rem, 3.1vw, 2.5rem); }
  .hero p.lead { font-size: 1.05rem; max-width: 66ch; }
  .hero-cta { margin-top: 1.2rem; }
  .section { padding: 30px 0; }
  .section-head { margin-bottom: 18px; }
}

/* Short viewports (a scaled 1080p panel, or a small window): squeeze harder so
   the hero plus the cards still read as one composition. */
@media (min-width: 820px) and (max-height: 820px) {
  .hero > .container { padding-top: 1.3rem; padding-bottom: 1.3rem; }
  .hero h1 { font-size: clamp(1.55rem, 2.7vw, 2.1rem); }
  .hero p.lead { font-size: 1rem; max-width: 70ch; line-height: 1.5; }
  .hero-cta { margin-top: 1rem; }
  .hero-cta .btn { padding: 10px 22px; }
  .section { padding: 20px 0; }
  .section-head { margin-bottom: 14px; }
  .post-item { padding: 16px 0; }
}

/* ---------------------------------------------------------------------------
   Mobile: the header was stacking to ~105px because the nav wrapped to its own
   row, pushing every page down by a tenth of the screen. Brand and nav share
   one row; the nav scrolls sideways instead of wrapping.
   ------------------------------------------------------------------------- */
@media (max-width: 620px) {
  .site-header .container {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .brand { gap: 8px; min-width: 0; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-line1 { font-size: 0.82rem; }
  .brand-line2 { font-size: 0.52rem; letter-spacing: 0.08em; }

  /* The nav is the same two-or-three items at every width now (Home, plus
     either Log in or the avatar), so it no longer needs to scroll. */
  .nav {
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: visible;
  }
  .nav a { font-size: 0.82rem; white-space: nowrap; }

  /* The brand must not wrap to three lines; clamp it to two. */
  .brand-text { min-width: 0; }
  .brand-line1,
  .brand-line2 { white-space: nowrap; }

  /* Mobile hero: less air, longer measure. */
  .hero > .container { padding-top: 1.6rem; padding-bottom: 1.6rem; }
  .hero h1 { font-size: 1.9rem; }
  .hero p.lead { font-size: 1rem; line-height: 1.55; }
  .section { padding: 30px 0; }
  .section-head { margin-bottom: 20px; }
}

/* The form-level `.btn { width: 100% }` rule was also catching the hero CTAs,
   forcing them full-width and stacking them on narrow screens. Hero buttons
   size to their label and sit in a row; they only wrap if the row cannot fit. */
.hero-cta .btn {
  width: auto;
  flex: 0 0 auto;
}

@media (max-width: 420px) {
  .hero-cta { gap: 10px; }
  .hero-cta .btn { padding: 11px 18px; font-size: 0.92rem; }
}

/* ===========================================================================
   Backgrounds as gradients, not photographs
   ---------------------------------------------------------------------------
   The photo backdrops were 2.2 MB across six JPEGs (the hero alone 544 KB) and
   each needed a scrim to stay legible. These gradients carry the same cool,
   low-light character at zero download cost, stay exactly on the Icy palette,
   and remove the CC-BY attribution obligation.

   Every colour used here is a palette token, so the backgrounds cannot drift
   off-brand the next time the palette changes.
   =========================================================================== */

/* --- Hero -------------------------------------------------------------- */
/* An aurora suggestion rather than a photograph: a soft teal-to-cyan glow off
   the upper right, fading into the ground. Deliberately low contrast so text
   over it keeps its 15.6:1 ratio. */
/* An aurora suggestion rather than a photograph: layered radial glows reading
   as light in a dark sky. Strengthened from the first attempt, which was so
   low-contrast it read as flat dark and lost the character the photo had.
   Text sits on the left over the darkest area, keeping its contrast ratio. */
.hero {
  background-image:
    radial-gradient(1100px 460px at 88% -14%, rgba(74, 209, 245, 0.42), transparent 62%),
    radial-gradient(820px 400px at 62% 4%, rgba(151, 228, 203, 0.30), transparent 66%),
    radial-gradient(700px 380px at 100% 30%, rgba(46, 157, 187, 0.26), transparent 70%),
    radial-gradient(640px 320px at 8% 116%, rgba(46, 157, 187, 0.20), transparent 74%),
    linear-gradient(166deg, #16303F 0%, #0F1D28 42%, #0A1219 100%);
  background-size: auto;
  background-position: center;
}

/* The scrim is no longer needed to darken a photograph, but a very light one
   keeps the bottom edge falling into the page below. */
.hero::before {
  background: linear-gradient(180deg, transparent 0%, transparent 40%, var(--nord0) 100%);
}

/* --- Page banners ------------------------------------------------------ */
/* One shared treatment so inner pages read as the same family. A faint fold
   line echoing the logo, plus a cool wash. */
.page-hero {
  background-image:
    radial-gradient(720px 260px at 84% -6%, rgba(74, 209, 245, 0.30), transparent 68%),
    radial-gradient(520px 220px at 100% 40%, rgba(151, 228, 203, 0.18), transparent 72%),
    linear-gradient(150deg, #16303F 0%, #0F1C27 55%, var(--nord0) 100%);
}

.page-hero::before {
  background: linear-gradient(90deg, rgba(14, 23, 32, 0.55) 0%, rgba(14, 23, 32, 0.05) 60%, transparent 100%);
}

