/*
  Callum Carolan Consultancy: prototype stylesheet.
  Inherits "Sovereign" (~/DESIGN.md). Every colour below is a Sovereign token;
  site-specific additions are recorded in ./DESIGN.md.
*/

:root {
  color-scheme: dark;

  /* Sovereign: planes */
  --neutral: #070708;
  --surface: #111113;
  --raised: #18181B;
  --overlay: #202024;

  /* Sovereign: ink */
  --primary: #F4F4F5;
  --body: #C9C9CE;
  --secondary: #9C9CA3;
  --muted: #86868E;
  --dim: #5D5D64;

  /* Sovereign: the one white fill, and focus */
  --tertiary: #FFFFFF;
  --on-tertiary: #070708;
  --tertiary-pressed: #D4D4D8;
  --focus: #FFFFFF;

  /* Sovereign: lines are white alpha on screen */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --hover: rgba(255, 255, 255, 0.06);
  --hover-row: rgba(255, 255, 255, 0.04);
  --pressed: rgba(255, 255, 255, 0.10);

  /* Sovereign: meaning. Used here only for prototype review marks. */
  --warn: #C9B27A;

  /* Type: system faces, no web fonts in the prototype */
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Site additions (see ./DESIGN.md) */
  --band: 128px;        /* space between bands */
  --masthead: 64px;
}

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

html {
  background: var(--neutral);
  color: var(--body);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--masthead) + 32px);
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd, figure {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  background: rgba(255, 255, 255, 0.20);
}

.mono {
  font-family: var(--mono);
}

.skip {
  position: absolute;
  left: 24px;
  top: -64px;
  z-index: 30;
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  background: var(--overlay);
  color: var(--primary);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
}

.skip:focus {
  top: 16px;
}

/* ─── Grid: 24 columns, 3 margin + 18 content + 3 margin ─── */

.grid {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  width: 100%;
  max-width: 1920px;
  margin-inline: auto;
}

.grid > * {
  grid-column: 4 / -4;
  min-width: 0;
}

/* A child that lays its own parts on the 18 content tracks */
.on-grid {
  display: grid;
  grid-template-columns: subgrid;
}

/* ─── Review marks (prototype only) ─── */

.flag {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 14px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--warn);
  white-space: nowrap;
}

.marks-off .flag {
  display: none;
}

/* ─── Icon: 16 grid, square caps, miter joins ─── */

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
  color: var(--secondary);
  transition: color 160ms var(--ease-out);
}

.icon--regular {
  stroke-width: 1;
}

/* ─── Buttons ─── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.btn:hover {
  transition-duration: 80ms, 120ms;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--tertiary);
  color: var(--on-tertiary);
}

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

.btn--primary:active {
  background: var(--tertiary-pressed);
}

.btn--secondary {
  background: transparent;
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.btn--secondary:hover {
  background: var(--hover);
}

.btn--secondary:active {
  background: var(--pressed);
}

.btn--compact {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 18px;
}

/* ─── Masthead ─── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--neutral);
}

.masthead::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: var(--line);
  opacity: 0;
  transition: opacity 200ms var(--ease-out);
}

.is-scrolled .masthead::after {
  opacity: 1;
}

.masthead__row {
  height: var(--masthead);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/*
  Lockup: the mark and the wordmark. The wordmark is live text in the site's
  own face: lowercase, 600, tight, one ink. The mark is 24 tall, which is its
  floor; the gap is a third of its height, as in the draft.
*/
.lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--primary);
  white-space: nowrap;
}

.lockup__mark {
  width: 28px;
  height: 24px;
  flex: none;
  fill: currentColor;
  position: relative;
  top: 1px;
}

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

.nav__links {
  display: flex;
  gap: 24px;
  font-size: 14px;
  line-height: 20px;
  color: var(--secondary);
}

.nav__links a {
  padding: 8px 0;
  transition: color 160ms var(--ease-out);
}

.nav__links a:hover {
  color: var(--primary);
  transition-duration: 80ms;
}

/* ─── Hero ─── */

.hero {
  padding-top: 128px;
  row-gap: 0;
}

.hero__title {
  grid-column: 1 / -1;
  font-size: 72px;
  line-height: 76px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.hero__title span {
  display: block;
  color: var(--secondary);
}

.hero__lead {
  grid-column: 1 / span 9;
  align-self: baseline;
  margin-top: 48px;
  font-size: 20px;
  line-height: 28px;
  color: var(--primary);
  text-wrap: pretty;
}

.hero__record {
  grid-column: 11 / -1;
  align-self: baseline;
  margin-top: 48px;
  color: var(--secondary);
  text-wrap: pretty;
}

.hero__record p + p {
  margin-top: 12px;
}

/* Facts strip: a four-column readout under the intro */
.facts {
  grid-column: 1 / -1;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.facts > div:nth-child(1) { grid-column: 1 / span 5; }
.facts > div:nth-child(2) { grid-column: 6 / span 5; }
.facts > div:nth-child(3) { grid-column: 11 / span 4; }
.facts > div:nth-child(4) { grid-column: 15 / span 4; }

.facts > div {
  padding-right: 24px;
}

.label {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
}

.facts dd {
  margin-top: 8px;
  font-size: 16px;
  line-height: 24px;
  color: var(--primary);
}

.facts dd .mono {
  font-size: 14px;
  color: var(--secondary);
  white-space: nowrap;
}

/* ─── Bands ─── */

.band {
  margin-top: var(--band);
  padding-top: 32px;
  border-top: 1px solid var(--line);
  row-gap: 32px;
}

.band__head {
  grid-column: 1 / span 5;
  align-self: start;
  position: sticky;
  top: calc(var(--masthead) + 32px);
  padding-right: 24px;
}

.band__title {
  font-size: 32px;
  line-height: 36px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--primary);
}

.band__desc {
  margin-top: 12px;
  max-width: 30ch;
  color: var(--secondary);
  text-wrap: pretty;
}

.band__body {
  grid-column: 6 / -1;
  min-width: 0;
}

/* ─── Cards ─── */

/*
  Cards share four row tracks (meta, title, text, foot) through subgrid, so
  titles and footers line up across a row whatever the copy length.
*/
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 0;
}

.card {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 4;
  padding: 24px;
  border-radius: 12px;
  corner-shape: squircle;
  background: var(--surface);
  transition: background-color 160ms var(--ease-out);
}

.card:nth-child(n + 3) {
  margin-top: 16px;
}

a.card:hover {
  background: var(--raised);
  transition-duration: 80ms;
}

a.card:active {
  background: var(--overlay);
}

a.card:hover .icon {
  color: var(--primary);
  transition-duration: 80ms;
}

.card__meta {
  font-size: 14px;
  line-height: 20px;
  color: var(--secondary);
}

.card__title {
  padding-top: 64px;
  font-size: 24px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--primary);
}

.card__desc {
  margin-top: 8px;
  color: var(--body);
  text-wrap: pretty;
}

.card__foot {
  align-self: end;
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 20px;
  font-size: 14px;
  line-height: 20px;
  color: var(--secondary);
}

.card__foot .mono {
  font-size: 12px;
  line-height: 16px;
}

.card__foot-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  min-width: 0;
}

/* Preview: same anatomy, drawn hollow. One hairline instead of a tone step. */
.card--preview {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 2px;
  background: var(--primary);
}

.dot--hollow {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--secondary);
}

/* ─── Posts ─── */

/* The first row starts level with the band title: no rule above it. */
.posts {
  margin-top: -20px;
}

.posts li {
  border-bottom: 1px solid var(--line);
}

.post {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 48px 16px;
  column-gap: 24px;
  align-items: baseline;
  margin-inline: -12px;
  padding: 20px 12px;
  border-radius: 8px;
  transition: background-color 160ms var(--ease-out);
}

.post:hover {
  background: var(--hover-row);
  transition-duration: 80ms;
}

.post:active {
  background: var(--pressed);
}

.post:hover .icon {
  color: var(--primary);
  transition-duration: 80ms;
}

.post__date {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  white-space: nowrap;
}

.post__title {
  display: block;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  color: var(--primary);
  text-wrap: pretty;
}

.post__sub {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 4px;
  font-size: 14px;
  line-height: 20px;
  color: var(--secondary);
}

.post__aud {
  font-size: 14px;
  line-height: 20px;
  color: var(--secondary);
}

.post .icon {
  align-self: start;
  margin-top: 4px;
}

.posts__foot {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}

.textlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  color: var(--primary);
}

.textlink:hover .icon {
  color: var(--primary);
  transition-duration: 80ms;
}

.posts__note {
  margin-top: 16px;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
}

/* ─── Usage strip ─── */

/* The usage title sits above its strip, not beside it, so it does not stick. */
.usage__head {
  grid-column: 1 / span 9;
  position: static;
}

.usage__status {
  grid-column: 1 / -1;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px 12px;
  font-size: 14px;
  line-height: 20px;
  color: var(--secondary);
}

.strip {
  grid-column: 1 / -1;
  row-gap: 32px;
  margin-top: 24px;
}

.strip > div {
  padding-right: 24px;
  min-width: 0;
}

.strip > div:nth-child(1) { grid-column: 1 / span 5; }
.strip > div:nth-child(2) { grid-column: 6 / span 3; }
.strip > div:nth-child(3) { grid-column: 9 / span 4; }
.strip > div:nth-child(4) { grid-column: 13 / span 3; }
.strip > div:nth-child(5) { grid-column: 16 / span 3; }

.strip dd {
  margin-top: 12px;
}

/* Fixed to the value's line so every cell's value sits on one baseline. */
.value-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  height: 24px;
}

.value {
  display: block;
  font-family: var(--mono);
  font-size: 20px;
  line-height: 24px;
  font-weight: 400;
  color: var(--primary);
  overflow-wrap: anywhere;
}

/*
  Daily bars: context days in secondary, the latest day in primary.
  20 tall, pushed down 2 so the bars stand on the value's text baseline.
*/
.bars {
  width: 148px;
  height: 20px;
  margin-top: -2px;
  flex: none;
}

.bars path {
  fill: var(--secondary);
}

.bars path:last-child {
  fill: var(--primary);
}

.strip .hint {
  margin-top: 8px;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
}

/* ─── Call ─── */

.call {
  margin-top: var(--band);
  padding-top: 32px;
  padding-bottom: var(--band);
  border-top: 1px solid var(--line);
}

.call__title {
  grid-column: 1 / span 12;
  font-size: 48px;
  line-height: 52px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--primary);
  text-wrap: balance;
}

.call__side {
  grid-column: 14 / -1;
  align-self: end;
}

.call__side p {
  color: var(--secondary);
  text-wrap: pretty;
}

.call__action {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

/* ─── Footer ─── */

.footer {
  padding-block: 32px 48px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 32px;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
  color: var(--secondary);
}

.footer__links a {
  padding: 8px 0;
  transition: color 160ms var(--ease-out);
}

.footer__links a:hover {
  color: var(--primary);
  transition-duration: 80ms;
}

/* Prototype bar: not part of the design. Remove at build. */
.proto {
  padding-block: 16px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--raised);
}

.segmented button {
  height: 24px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--secondary);
  font: inherit;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  background: var(--overlay);
  color: var(--primary);
}

/* ─── Large screens: the one-line statement grows with the room ─── */

@media (min-width: 1680px) {
  .hero__title {
    font-size: 88px;
    line-height: 92px;
  }
}

/* ─── Tablet: 720–1199. Two-column margins, labels stack above content ─── */

@media (max-width: 1199px) {
  :root {
    --band: 96px;
  }

  .grid > * {
    grid-column: 3 / -3;
  }

  .on-grid {
    display: block;
  }

  .hero {
    padding-top: 96px;
  }

  .hero__title {
    font-size: 56px;
    line-height: 60px;
  }

  .hero__lead,
  .hero__record {
    max-width: 640px;
  }

  .hero__record {
    margin-top: 24px;
  }

  .facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px 0;
  }

  .facts > div:nth-child(n) {
    grid-column: auto;
  }

  .band__head {
    position: static;
    padding-right: 0;
    margin-bottom: 32px;
  }

  .band__desc {
    max-width: 56ch;
  }

  .usage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 24px;
    row-gap: 0;
  }

  .usage .band__head {
    grid-column: 1;
    margin-bottom: 0;
  }

  .usage__status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .strip {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 32px 0;
    margin-top: 32px;
  }

  .strip > div:nth-child(n) {
    grid-column: auto;
  }

  .strip > div:nth-child(1) {
    grid-column: 1 / -1;
  }

  .call__title {
    font-size: 40px;
    line-height: 44px;
    max-width: 18ch;
  }

  .call__side {
    margin-top: 32px;
    max-width: 480px;
  }
}

@media (max-width: 899px) {
  .nav__links {
    display: none;
  }

  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ─── Phone: under 720. One column, 24 inset, touch targets ─── */

@media (max-width: 719px) {
  :root {
    --band: 64px;
    --masthead: 56px;
  }

  .grid {
    display: block;
    padding-inline: 24px;
  }

  .lockup__rest {
    display: none;
  }

  .btn--compact {
    height: 44px;
    padding: 0 16px;
    font-size: 14px;
    line-height: 20px;
  }

  .hero {
    padding-top: 64px;
  }

  .hero__title {
    font-size: 40px;
    line-height: 44px;
  }

  .hero__lead {
    margin-top: 32px;
    font-size: 18px;
    line-height: 26px;
  }

  .facts {
    margin-top: 48px;
  }

  .band__title {
    font-size: 24px;
    line-height: 28px;
    letter-spacing: -0.01em;
  }

  .cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .card + .card {
    margin-top: 12px;
  }

  .card__title {
    padding-top: 48px;
  }

  .post {
    grid-template-columns: minmax(0, 1fr) 16px;
    column-gap: 16px;
    row-gap: 8px;
  }

  .post__date {
    grid-column: 1;
    grid-row: 1;
  }

  .post__main {
    grid-column: 1;
    grid-row: 2;
  }

  .post__aud {
    grid-column: 1;
    grid-row: 3;
  }

  .post .icon {
    grid-column: 2;
    grid-row: 2;
  }

  .posts__foot .btn {
    width: 100%;
  }

  .textlink {
    min-height: 44px;
  }

  .usage {
    display: block;
  }

  .usage__status {
    justify-self: start;
    justify-content: flex-start;
    margin-top: 16px;
  }

  .strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .call__title {
    font-size: 32px;
    line-height: 36px;
    letter-spacing: -0.015em;
  }

  .call__action .btn {
    width: 100%;
  }

  .footer {
    flex-direction: column;
    gap: 16px;
  }

  .footer__links a {
    padding: 12px 0;
  }

  .segmented button {
    height: 40px;
    padding: 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: #74747C;
    --line-strong: #74747C;
    --secondary: #C9C9CE;
    --muted: #9C9CA3;
  }
}
