/*
 * Tibeb Creative / TCDP public site.
 *
 * Loaded AFTER brand/master/tokens/tibeb-brand.css. Every colour, radius and
 * font family below is a Master Brand token (--tc-*). No colour literal appears
 * in this file, and tests/site.test.mjs fails the build if one does: the brand
 * guide's rule is "contrast is a gate: new color pairs are measured before use".
 *
 * Contrast pairs used, all from the guide's measured table (§8):
 *   Ink on White 14.68 · Indigo on White 10.00 · Gray on White 4.83 (secondary
 *   text on the default surface ONLY; Gray on Mist is 4.47 and is not used for
 *   text) · White on Indigo 10.00 · Sky on Ink 6.24 · Ink on Sky 6.24.
 *
 * Mobile first: the base rules are the small-screen layout; wider screens add.
 */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/brand/master/typography/fonts/InterVariable.woff2") format("woff2");
}

@font-face {
  font-family: Inter;
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/brand/master/typography/fonts/InterVariable-Italic.woff2") format("woff2");
}

/* Only downloaded when a page actually contains Ethiopic characters. */
@font-face {
  font-family: "Noto Sans Ethiopic";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/brand/master/typography/fonts/NotoSansEthiopic-Variable.ttf") format("truetype");
  unicode-range: U+1200-137F, U+1380-139F, U+2D80-2DDF, U+AB00-AB2F;
}

:root {
  --site-max: 72rem;
  --site-gutter: 1rem;
  --space-1: calc(var(--tc-space-unit) * 1);
  --space-2: calc(var(--tc-space-unit) * 2);
  --space-3: calc(var(--tc-space-unit) * 3);
  --space-4: calc(var(--tc-space-unit) * 4);
  --space-5: calc(var(--tc-space-unit) * 5);
  --space-6: calc(var(--tc-space-unit) * 6);
  --space-8: calc(var(--tc-space-unit) * 8);
  --space-10: calc(var(--tc-space-unit) * 10);
  --space-12: calc(var(--tc-space-unit) * 12);
  --space-16: calc(var(--tc-space-unit) * 16);
  --space-20: calc(var(--tc-space-unit) * 20);

  /* Guide §14: primary CTA = Indigo fill + white label. */
  --cta-bg: var(--tc-action-primary);
  --cta-bg-hover: var(--tc-action-primary-hover);
  --cta-fg: var(--tc-text-on-brand);
}

/* On dark surfaces the action colour becomes Sky, and white on Sky is 2.35:1,
   so the label turns Ink (6.24:1): the guide's accent CTA. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cta-bg-hover: var(--tc-action-primary);
    --cta-fg: var(--tc-ink);
  }
}

:root[data-theme="dark"] {
  --cta-bg-hover: var(--tc-action-primary);
  --cta-fg: var(--tc-ink);
}

@media (min-width: 48rem) {
  :root {
    --site-gutter: 2rem;
  }
}

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

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

body {
  margin: 0;
  font-family: var(--tc-font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--tc-text-primary);
  background: var(--tc-surface-default);
}

img,
svg {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0 0 var(--space-4);
  color: inherit;
  text-wrap: balance;
}

/* Page titles sit between the H2 (32) and H1 (40) steps of the brand scale;
   the hero title between H1 (40) and Display (56). */
h1 {
  font-family: var(--tc-font-display);
  font-weight: 700;
  font-size: clamp(2rem, 1.6rem + 1.6vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h2 {
  font-family: var(--tc-font-sans);
  font-weight: 600;
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* Brand H3 is 24 px (tokens); it steps down to 20 px on narrow screens,
   where card titles sit in a single column. */
h3 {
  font-family: var(--tc-font-sans);
  font-weight: 600;
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  line-height: 1.33;
  letter-spacing: -0.005em;
}

p,
ul,
ol,
dl {
  margin: 0 0 var(--space-4);
}

p:last-child,
ul:last-child,
ol:last-child,
dl:last-child {
  margin-bottom: 0;
}

a {
  color: var(--tc-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--tc-focus-ring);
  outline-offset: 3px;
  border-radius: var(--tc-radius-sm);
}

main:focus {
  outline: none;
}

:lang(am) {
  line-height: 1.75;
  letter-spacing: 0;
}

/* Guide §9: Amharic is never set in uppercase-tracked eyebrows. */
.eyebrow:lang(am) {
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- utilities ---------- */

.wrap {
  width: 100%;
  max-width: var(--site-max);
  margin-inline: auto;
  padding-inline: var(--site-gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 10;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--tc-radius-md);
  background: var(--cta-bg);
  color: var(--cta-fg);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.eyebrow {
  margin: 0 0 var(--space-3);
  color: var(--tc-text-brand);
  text-transform: uppercase;
}

.lead {
  font-size: 1.125rem;
  line-height: 1.6;
  max-width: 44rem;
}

.muted {
  color: var(--tc-text-secondary);
}

.prose {
  max-width: 44rem;
}

/* On a .wrap, prose keeps the page's left edge and limits its children. */
.wrap.prose {
  max-width: var(--site-max);
}

.wrap.prose > * {
  max-width: 44rem;
}

/* ---------- header and navigation ---------- */

.site-header {
  background: var(--tc-surface-default);
  border-bottom: 1px solid var(--tc-border-default);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  padding-block: var(--space-3);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  border-radius: var(--tc-radius-sm);
}

/* Guide §6 minimum sizes: compact lockup at least 110 px wide, horizontal
   no-tagline at least 120 px wide. These heights keep both above that. */
.brand-logo {
  display: block;
  height: 3.25rem;
  width: auto;
}

@media (min-width: 30.0625rem) {
  .brand-logo {
    height: 2.75rem;
  }
}

.site-nav {
  width: 100%;
}

@media (min-width: 64rem) {
  .site-nav {
    width: auto;
  }
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: var(--space-2);
  border-radius: var(--tc-radius-sm);
  color: var(--tc-text-primary);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
}

/* The header list's first label lines up with the logo and page text. */
.site-nav .nav-list {
  margin-inline: calc(-1 * var(--space-2));
}

@media (min-width: 24rem) {
  .nav-list a {
    font-size: 0.9375rem;
  }
}

@media (min-width: 48rem) {
  .nav-list {
    gap: var(--space-1) var(--space-2);
  }

  .nav-list a {
    padding: var(--space-2) var(--space-3);
  }

  .site-nav .nav-list {
    margin-inline: calc(-1 * var(--space-3));
  }
}

@media (min-width: 64rem) {
  .site-nav .nav-list {
    margin-inline: 0 calc(-1 * var(--space-3));
  }
}

.nav-list a:hover {
  text-decoration: underline;
  background: var(--tc-surface-subtle);
}

.nav-list a:active {
  background: var(--tc-border-default);
}

.nav-list a[aria-current="page"] {
  color: var(--tc-text-brand);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* TCDP: Ink surface, white type, Sky accents (guide §11). */
.site-header--tcdp {
  background: var(--tc-surface-inverse);
  border-bottom-color: var(--tc-surface-inverse);
  --tc-focus-ring: var(--tc-sky);
}

.site-header--tcdp .nav-list a {
  color: var(--tc-white);
}

/* On Ink the hover state is the underline alone: no new colour pair. */
.site-header--tcdp .nav-list a:hover,
.site-header--tcdp .nav-list a:active {
  background: transparent;
  text-decoration-thickness: 2px;
}

.site-header--tcdp .nav-list a[aria-current="page"] {
  color: var(--tc-sky);
}

/* ---------- breadcrumbs ---------- */

.breadcrumb {
  border-bottom: 1px solid var(--tc-border-default);
  font-size: 0.875rem;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb-list li {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
}

/* The separator is drawn, not written, so screen readers announce the list
   and its items only. It ends the item before it, so a trail that wraps on a
   phone never starts a line with a separator. */
.breadcrumb-list li:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin-inline: 0.5em 0.75em;
  border-top: 1.5px solid var(--tc-text-secondary);
  border-right: 1.5px solid var(--tc-text-secondary);
  transform: rotate(45deg);
}

.breadcrumb {
  padding-block: var(--space-2);
}

/* 32 px targets: above the WCAG 2.2 AA minimum of 24 px, and compact enough
   that a wrapped trail stays short on a phone. */
.breadcrumb-list a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
}

.breadcrumb-list [aria-current="page"] {
  color: var(--tc-text-secondary);
}

/* ---------- sections ---------- */

.section {
  padding-block: var(--space-12);
}

@media (min-width: 48rem) {
  .section {
    padding-block: var(--space-20);
  }
}

.section-head {
  max-width: 44rem;
  margin-bottom: var(--space-8);
}

/* A section that is only a heading block (a page title with no hero) ends
   with the block, not with a gap for content that is not there. */
.section-head:last-child {
  margin-bottom: 0;
}

.section--subtle {
  background: var(--tc-surface-subtle);
}

/* Gray on Mist is below 4.5:1, so secondary text becomes primary here. */
.section--subtle .muted {
  color: var(--tc-text-primary);
}

.section--brand,
.section--inverse {
  color: var(--tc-white);
  --tc-focus-ring: var(--tc-sky);
}

.section--brand {
  background: var(--tc-surface-brand);
}

.section--inverse {
  background: var(--tc-surface-inverse);
}

/* In dark mode the page itself is Ink, so an Ink band needs visible edges. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .section--inverse {
    border-block: 1px solid var(--tc-border-default);
  }
}

:root[data-theme="dark"] .section--inverse {
  border-block: 1px solid var(--tc-border-default);
}

.section--brand a:not(.button),
.section--brand .eyebrow,
.section--brand .muted {
  color: var(--tc-white);
}

.section--inverse a:not(.button),
.section--inverse .eyebrow {
  color: var(--tc-sky);
}

.section--inverse .muted {
  color: var(--tc-white);
}

/* ---------- hero ---------- */

.hero {
  padding-block: var(--space-16);
}

@media (min-width: 48rem) {
  .hero {
    padding-block: var(--space-20);
  }
}

.hero h1 {
  max-width: 48rem;
  font-size: clamp(2.125rem, 1.5rem + 3vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* TCDP's own lockup where the front door presents TCDP (guide §11). 72 px
   tall keeps the full lockup well above the 200 px minimum width of a
   lockup with tagline (guide §6). */
.hero-lockup {
  display: block;
  height: 4.5rem;
  width: auto;
  margin-bottom: var(--space-6);
}

.tagline {
  margin: 0 0 var(--space-6);
  font-weight: 600;
  font-size: 1.125rem;
}

/* ---------- actions ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-8);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: var(--space-3) var(--space-5);
  border: 2px solid transparent;
  border-radius: var(--tc-radius-md);
  text-decoration: none;
}

.button--primary {
  background: var(--cta-bg);
  color: var(--cta-fg);
}

.button--primary:hover {
  background: var(--cta-bg-hover);
  text-decoration: underline;
}

.button--secondary {
  border-color: currentColor;
  color: var(--tc-link);
}

.button--secondary:hover {
  text-decoration: underline;
  border-width: 3px;
  padding-inline: calc(var(--space-5) - 1px);
}

.button:active {
  transform: translateY(1px);
}

.section--brand .button--primary {
  background: var(--tc-white);
  color: var(--tc-indigo);
}

.section--brand .button--secondary {
  color: var(--tc-white);
}

/* Guide §14: accent CTA = Sky fill + Ink label. */
.section--inverse .button--primary {
  background: var(--tc-sky);
  color: var(--tc-ink);
}

.section--inverse .button--secondary {
  color: var(--tc-sky);
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .nav-list a,
  .card--link {
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
}

/* ---------- grids and cards ---------- */

.grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .grid--2,
  .grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 64rem) {
  .grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  border: 1px solid var(--tc-border-default);
  border-radius: var(--tc-radius-lg);
  background: var(--tc-surface-default);
  color: var(--tc-text-primary);
}

.card h3 {
  margin: 0;
}

.card > :last-child {
  margin-top: auto;
}

.card p {
  margin: 0;
}

/* A product name that is an h2 on the directory page but reads at h3 size. */
.h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  line-height: 1.33;
  letter-spacing: -0.005em;
  margin: 0;
}

.card-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.card-note {
  font-size: 0.875rem;
}

/* Doubled class: this block sits before the base .meta rule in the file and
   must still win over it. */
.meta.meta--roomy {
  gap: var(--space-3) var(--space-4);
  font-size: 1rem;
  line-height: 1.6;
}

@media (max-width: 39.9375rem) {
  .meta.meta--roomy {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-1);
  }

  .meta.meta--roomy dd {
    margin-bottom: var(--space-3);
  }
}

.meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
}

.meta dt {
  font-weight: 600;
}

.meta dd {
  margin: 0;
}

.status {
  display: inline-block;
  padding: 0 var(--space-2);
  border: 1px solid currentColor;
  border-radius: var(--tc-radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.status--live {
  border-color: var(--cta-bg);
  background: var(--cta-bg);
  color: var(--cta-fg);
}

.status--in-development,
.status--planned {
  border-style: dashed;
}

.status-legend {
  margin-top: var(--space-6);
}

/* A card whose heading link is its one destination: the whole card is the
   target, and it answers hover and keyboard focus. */
.card--link {
  position: relative;
}

.card-link {
  text-decoration: none;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--tc-radius-lg);
}

.card--link:hover,
.card--link:focus-within {
  border-color: var(--tc-text-brand);
}

.card--link:hover .card-link {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* ---------- showcase entries ---------- */

.features {
  display: grid;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature {
  display: grid;
  gap: var(--space-6);
  padding: var(--space-6);
  border: 1px solid var(--tc-border-default);
  border-radius: var(--tc-radius-lg);
  background: var(--tc-surface-default);
  color: var(--tc-text-primary);
  scroll-margin-top: var(--space-4);
}

@media (min-width: 64rem) {
  .feature {
    padding: var(--space-8);
  }

  .feature--media {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
  }
}

.feature-body {
  max-width: 48rem;
  display: grid;
  gap: var(--space-3);
  justify-items: start;
}

.feature-body > * {
  margin: 0;
}

.feature-body .meta,
.feature-body .actions {
  margin-top: var(--space-2);
}

.list-label {
  font-weight: 600;
}

.checklist {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding-left: var(--space-6);
}

.checklist li::before {
  content: "";
  position: absolute;
  left: var(--space-1);
  top: 0.55em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  background: var(--tc-text-brand);
}

.actions--tight {
  margin-top: 0;
}

.feature-media {
  align-content: start;
}

/* ---------- ecosystem layers ---------- */

.layers {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: layer;
}

@media (min-width: 64rem) {
  .layers {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.layers li {
  padding: var(--space-5);
  border-left: 4px solid var(--tc-text-brand);
  border-radius: var(--tc-radius-sm);
  background: var(--tc-surface-default);
}

.layers h3 {
  margin-bottom: var(--space-2);
  font-size: 1.125rem;
}

.layers p {
  margin: 0;
}

/* ---------- brand artwork swatches ---------- */

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* A badge is shown on the surface it is made for (guide §3 color modes):
   the color badge on white, the white badge on Ink, in either page scheme. */
.swatch {
  padding: var(--space-4);
  border: 1px solid var(--tc-border-default);
  border-radius: var(--tc-radius-md);
}

.swatch--light {
  background: var(--tc-white);
}

.swatch-img {
  display: block;
  width: 13rem;
  max-width: 100%;
  height: auto;
}

/* Raster artwork (share images, covers) fills its column instead. */
.swatch--plain {
  flex: 1 1 100%;
  padding: 0;
  overflow: hidden;
}

.swatch-img--photo {
  width: 100%;
}

.swatch--inverse {
  background: var(--tc-ink);
}

/* ---------- footer ---------- */

.site-footer {
  padding-block: var(--space-10);
  border-top: 1px solid var(--tc-border-default);
  font-size: 0.875rem;
}

.footer-inner {
  display: grid;
  gap: var(--space-4);
}

.site-footer .nav-list {
  margin-inline: calc(-1 * var(--space-2));
}

@media (min-width: 48rem) {
  .site-footer .nav-list {
    margin-inline: calc(-1 * var(--space-3));
  }
}

.site-footer .nav-list a {
  min-height: 2.75rem;
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

/* ---------- contact channels and social links ---------- */

.contact-inline,
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-inline a,
.social-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  overflow-wrap: anywhere;
}

.contact-label {
  font-weight: 600;
}

address {
  font-style: normal;
}

.meta dd a {
  overflow-wrap: anywhere;
}

/* ---------- notices (preview placeholders) ---------- */

.notice {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--tc-border-default);
  border-left: 4px solid var(--tc-text-brand);
  border-radius: var(--tc-radius-sm);
  background: var(--tc-surface-subtle);
  color: var(--tc-text-primary);
}

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.875em;
  overflow-wrap: anywhere;
}
