/* ARcloud – four time-of-day themes (dawn, day, dusk, night).
   All colours live in the tokens below; keep text/background pairs at WCAG 2.2 AA (4.5:1). */

:root {
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --space-6: 64px;
  --fade: 0.8s;
}

/* Day is the default, so the page is readable without JavaScript. */
:root,
:root[data-theme="day"] {
  --text: #1c1c1e;
  --muted: #4b5563;
  --surface: #ffffff;
  --border: #cdd9ea;
  --link: #1f5fad;
  --tag-bg: #edf0f8;
  --tag-text: #1f4f8a;
  --focus: #1f5fad;
  --shadow: 0 1px 2px rgb(28 40 80 / 0.06), 0 8px 24px rgb(28 40 80 / 0.08);
}
:root[data-theme="dawn"] {
  --text: #2b2233;
  --muted: #5a4e66;
  --surface: #fff8f3;
  --border: #e8cfc4;
  --link: #a32d63;
  --tag-bg: #f6e4ee;
  --tag-text: #6e1f45;
  --focus: #a32d63;
  --shadow: 0 1px 2px rgb(90 40 60 / 0.06), 0 8px 24px rgb(90 40 60 / 0.1);
}
:root[data-theme="dusk"] {
  --text: #fff4ec;
  --muted: #e6d6e4;
  --surface: #3a2f5c;
  --border: #6a5a8f;
  --link: #ffc9a3;
  --tag-bg: #4a3d70;
  --tag-text: #ffe9da;
  --focus: #ffc9a3;
  --shadow: 0 8px 28px rgb(10 5 30 / 0.35);
}
:root[data-theme="night"] {
  --text: #edeff7;
  --muted: #a9b0c6;
  --surface: #121a33;
  --border: #2a3558;
  --link: #8dbdf5;
  --tag-bg: #1c2646;
  --tag-text: #c5d6f2;
  --focus: #8dbdf5;
  --shadow: 0 8px 28px rgb(0 0 0 / 0.45);
}

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

html { color-scheme: light; }
:root[data-theme="dusk"],
:root[data-theme="night"] { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: #f5f6fa; /* fallback behind the sky layers */
}

/* Sky: four stacked gradients that cross-fade (gradients cannot be transitioned directly). */
.sky { position: fixed; inset: 0; z-index: -1; }
.sky__layer { position: absolute; inset: 0; opacity: 0; transition: opacity var(--fade) ease; }
.sky__layer--dawn  { background: linear-gradient(180deg, #ffe3d3 0%, #e6d9f5 100%); }
.sky__layer--day   { background: linear-gradient(180deg, #f5f6fa 0%, #dce9fa 100%); }
.sky__layer--dusk  { background: linear-gradient(180deg, #2b2547 0%, #8a4a6f 100%); }
.sky__layer--night { background: linear-gradient(180deg, #070b18 0%, #1b1238 100%); }

:root .sky__layer--day,
:root[data-theme="day"] .sky__layer--day,
:root[data-theme="dawn"] .sky__layer--dawn,
:root[data-theme="dusk"] .sky__layer--dusk,
:root[data-theme="night"] .sky__layer--night { opacity: 1; }
:root[data-theme="dawn"] .sky__layer--day,
:root[data-theme="dusk"] .sky__layer--day,
:root[data-theme="night"] .sky__layer--day { opacity: 0; }

.wrap {
  width: 100%;
  max-width: 960px;
  margin-inline: auto;
  padding-inline: var(--space-3);
}

a { color: var(--link); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute;
  left: var(--space-3);
  top: -100px;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  z-index: 10;
}
.skip:focus { top: var(--space-3); }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-4);
}
.brand { margin: 0; font-weight: 700; letter-spacing: 0.02em; }

.theme-switch { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.theme-switch[hidden] { display: none; }
.theme-switch button {
  min-height: 44px;
  min-width: 44px;
  padding: 0 var(--space-3);
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.theme-switch button:hover { background: var(--surface); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); border-color: var(--text); font-weight: 600; }

.intro { padding-block: var(--space-5) var(--space-4); max-width: 38rem; }
h1 { margin: 0 0 var(--space-3); font-size: clamp(2rem, 6vw, 3rem); line-height: 1.15; font-weight: 700; }
.lead { margin: 0; font-size: 1.125rem; color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: background-color var(--fade) ease, border-color var(--fade) ease, color var(--fade) ease;
}
.card > p { margin: 0; }
.card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.card h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.card h2 a { color: var(--text); }
.card__meta { margin: 0; font-size: 0.875rem; color: var(--muted); }
.card__link { margin-top: auto !important; font-size: 0.9375rem; }

.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.tags li { padding: var(--space-1) 12px; font-size: 0.8125rem; font-weight: 500; color: var(--tag-text); background: var(--tag-bg); border-radius: 999px; }

.site-footer { padding-block: var(--space-6) var(--space-5); font-size: 0.875rem; color: var(--muted); }
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  :root { --fade: 0s; }
}

@media (max-width: 480px) {
  .site-header { padding-block: var(--space-3); }
  .card { padding: var(--space-3); }
}
