/* Australia, by the numbers — editorial civic dashboard.
   Warm paper + ink + Australian earth palette. Fraunces display, Public Sans
   for body and tabular figures. Asymmetric grid, varied spacing, no identical cards. */

:root {
  --paper: #fbf7ef;
  --paper-sunk: #f4ecdd;
  --ink: #201d17;
  --muted: #5d5648;          /* >=4.5:1 on paper */
  --line: rgba(32, 29, 23, 0.14);
  --ochre: #b5642d;          /* earth accent */
  --euc: #38614a;            /* eucalyptus, positive */
  --clay: #9c3a2c;           /* red earth, the stats to watch */
  --gold: #c79347;

  --step--1: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.12rem);
  --step-1: clamp(1.3rem, 1.1rem + 0.9vw, 1.7rem);
  --step-2: clamp(1.8rem, 1.4rem + 1.8vw, 2.6rem);
  --step-3: clamp(2.6rem, 1.9rem + 3.4vw, 4.6rem);
  --figure: clamp(2.3rem, 1.7rem + 2.6vw, 3.4rem);
  --figure-lg: clamp(3rem, 2.2rem + 3.6vw, 4.6rem);

  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* ease-out-quint-ish */
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 100% -10%, rgba(197, 147, 71, 0.10), transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: "Public Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  /* subtle paper grain */
  background-attachment: fixed;
}

a { color: var(--ochre); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--clay); }

a, button { touch-action: manipulation; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: 0 0 10px 0;
  z-index: 10;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--ochre);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Masthead ---------------------------------------------------------- */
.masthead {
  max-width: 64rem;
  margin: 0 auto;
  padding: clamp(2.4rem, 5vw, 4.5rem) clamp(1.2rem, 5vw, 3rem) clamp(1.4rem, 3vw, 2.4rem);
}

.eyebrow {
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ochre);
  font-weight: 600;
  margin: 0 0 0.9rem;
}

h1 {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: var(--step-3);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 1.1rem;
  max-width: 16ch;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--ink);
  max-width: 46ch;
  margin: 0 0 1.4rem;
  font-weight: 400;
}

.refreshed {
  font-size: var(--step--1);
  color: var(--muted);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.refreshed::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--euc);
  box-shadow: 0 0 0 4px rgba(56, 97, 74, 0.18);
}

/* ---- The board --------------------------------------------------------- */
.board {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(1.4rem, 3vw, 2.4rem) clamp(1.2rem, 5vw, 3rem) 3rem;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(0.9rem, 2vw, 1.5rem);
  container-type: inline-size;
}

/* Varied spans so the grid breathes instead of marching in identical squares. */
.tile { grid-column: span 6; }
@media (min-width: 38rem) {
  .tile { grid-column: span 3; }
  .tile--feature { grid-column: span 4; }
  .tile--narrow { grid-column: span 2; }
}
@media (min-width: 58rem) {
  .tile--feature { grid-column: span 3; grid-row: span 2; }
  .tile { grid-column: span 3; }
}

.tile {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.15));
  padding: clamp(1.1rem, 2.2vw, 1.6rem);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 9.5rem;
  isolation: isolate;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
/* Ambient lift only — tiles are informational, not buttons, so the hover stays
   subtle (shadow + border) rather than the pronounced jump of a clickable card. */
.tile:hover {
  box-shadow: 0 10px 26px -20px rgba(32, 29, 23, 0.4);
  border-color: rgba(32, 29, 23, 0.22);
}

.tile__kicker {
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}
.tile__kicker svg { width: 17px; height: 17px; stroke: var(--ochre); }

.tile__figure {
  font-family: "Public Sans", sans-serif;
  font-weight: 700;
  font-feature-settings: "tnum" 1, "lnum" 1; /* aligned tabular numerals */
  font-size: var(--figure);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0.2rem 0 0;
}
.tile--feature .tile__figure { font-size: var(--figure-lg); }

.tile__label {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: var(--step-1);
  line-height: 1.2;
  margin: 0;
}
.tile--feature .tile__label { font-size: var(--step-2); max-width: 14ch; }

/* ---- Trend chart ------------------------------------------------------- */
.tile__chart { margin-top: 0.6rem; }
.chart {
  display: block;
  width: 100%;
  height: 34px;
  overflow: visible;
}
.tile--feature .chart { height: 54px; }
.chart__line { fill: none; stroke: var(--ochre); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart__area { fill: rgba(181, 100, 45, 0.12); stroke: none; }
.chart__zero { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.chart__dot { fill: var(--euc); stroke: var(--paper); stroke-width: 1; }
.tile--watch .chart__line { stroke: var(--clay); }
.tile--watch .chart__area { fill: rgba(156, 58, 44, 0.10); }
.tile--watch .chart__dot { fill: var(--clay); }

.chart__caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.45rem;
  font-size: var(--step--1);
}
.chart__range { color: var(--muted); font-variant-numeric: tabular-nums; }
.chart__compare { display: block; margin-top: 0.25rem; font-size: var(--step--1); }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta--good { color: var(--euc); }
.delta--bad { color: var(--clay); }
.delta--flat { color: var(--muted); }

.tile__meta {
  margin-top: auto;
  padding-top: 0.7rem;
  font-size: var(--step--1);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  border-top: 1px dashed var(--line);
}
.tile__source { font-weight: 600; }
.tile__source[data-source="live"] { color: var(--euc); }
.tile__source[data-source="cached"] { color: var(--gold); }

/* Negative / "stats to watch" — tinted whole, not a stripe on one edge. */
.tile--watch {
  background: linear-gradient(180deg, rgba(156, 58, 44, 0.07), rgba(156, 58, 44, 0.02));
  border-color: rgba(156, 58, 44, 0.24);
}
.tile--watch .tile__kicker svg { stroke: var(--clay); }

/* Placeholder tiles, honestly labelled. */
.tile--pending { background: var(--paper-sunk); }
.tile--pending .tile__figure { color: var(--muted); font-weight: 600; }
.chip {
  align-self: flex-start;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--clay);
  background: rgba(156, 58, 44, 0.12);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.tile__figure[data-loading="true"] {
  color: transparent;
  background: linear-gradient(90deg, var(--paper-sunk), rgba(255,255,255,.6), var(--paper-sunk));
  background-size: 200% 100%;
  border-radius: 8px;
  animation: shimmer 1.4s var(--ease) infinite;
  width: 60%;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Entrance: one orchestrated, staggered reveal. */
.tile { opacity: 0; transform: translateY(14px); }
.tile.is-in { opacity: 1; transform: none; transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }

/* ---- Colophon ---------------------------------------------------------- */
.colophon {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem clamp(1.2rem, 5vw, 3rem) 4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.colophon h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: var(--step-1);
  color: var(--ink);
  margin: 0 0 0.6rem;
}
.colophon p { font-size: var(--step--1); max-width: 60ch; margin: 0 0 0.7rem; }
.colophon .credit { color: var(--ink); font-weight: 500; }

/* ---- Motion preference ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
  .tile { opacity: 1; transform: none; transition: opacity 0.2s linear; }
  .tile:hover { transform: none; }
  .tile__figure[data-loading="true"] { animation: none; }
}

/* Clickable affordance on interactive elements */
a, button, [role="button"] { cursor: pointer; }
a:active, button:active { transform: scale(0.97); opacity: 0.75; }
