/* Cloudy Tuesdays (cloudytuesdays.com): a quiet studio page in the brand's overcast sky.
   System fonts only, nothing from other origins, no inline styles (the CSP allows 'self' only).
   Follows the system theme; site.js adds a toggle that sets data-theme on <html>. */

/* --- Tokens ---------------------------------------------------------------------------------------- */

:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --ink: #0b0d12;
  --ink-soft: #2d333c;
  --muted: #535b67;
  --hairline: rgba(12, 16, 24, 0.09);
  --shadow: 0 1px 2px rgba(12, 16, 24, 0.04), 0 18px 40px -26px rgba(30, 44, 66, 0.28);
  --focus: #1f6fb2;
  --accent: #4f6276;
  --btn-bg: #0b0d12;
  --btn-ink: #ffffff;
  --soon: #2f7a52;

  /* Brand sky (from the logo: #6F8295 -> #A9B6C2, cloud #FBFAF7) */
  --sky-top: #6f8295;
  --sky-bottom: #a9b6c2;
  --sky-deep: #4f6276;
  --cloud: #fbfaf7;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", Roboto, Arial, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Roboto, Arial, sans-serif;

  --gutter: max(1rem, env(safe-area-inset-left), env(safe-area-inset-right));
  --max: 68rem;
  --r: 1.5rem;
}

@media (min-width: 40rem) {
  :root { --gutter: clamp(1.5rem, 4vw, 2.5rem); }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #08090c;
    --surface: #111318;
    --ink: #f1f3f6;
    --ink-soft: #c6ccd4;
    --muted: #9aa3ae;
    --hairline: rgba(255, 255, 255, 0.09);
    --shadow: 0 30px 60px -34px rgba(0, 0, 0, 0.8);
    --focus: #8cc4f5;
    --accent: #a9b6c2;
    --btn-bg: #f1f3f6;
    --btn-ink: #08090c;
    --soon: #7fe0a8;
    --sky-top: #2a3542;
    --sky-bottom: #55677a;
    --sky-deep: #1b232d;
    --cloud: #dfe5ec;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08090c;
  --surface: #111318;
  --ink: #f1f3f6;
  --ink-soft: #c6ccd4;
  --muted: #9aa3ae;
  --hairline: rgba(255, 255, 255, 0.09);
  --shadow: 0 30px 60px -34px rgba(0, 0, 0, 0.8);
  --focus: #8cc4f5;
  --accent: #a9b6c2;
  --btn-bg: #f1f3f6;
  --btn-ink: #08090c;
  --soon: #7fe0a8;
  --sky-top: #2a3542;
  --sky-bottom: #55677a;
  --sky-deep: #1b232d;
  --cloud: #dfe5ec;
}

/* --- Base ------------------------------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

h1, h2, h3 { margin: 0; font-family: var(--sans); color: var(--ink); text-wrap: balance; }
p { margin: 0; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 0.4rem; }

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: 0.75rem;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 0.75rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.eyebrow {
  color: var(--muted);
  font: 600 0.8rem/1.3 var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- Header ---------------------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--hairline);
}

.bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.75rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  font: 650 1.05rem/1 var(--sans);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark svg { width: 1.9rem; height: 1.9rem; flex: none; }

.bar nav ul { display: flex; gap: 0.15rem; }
.bar nav a {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 0.6rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  text-decoration: none;
}
.bar nav a:hover { color: var(--ink); background: var(--hairline); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle svg { width: 1.2rem; height: 1.2rem; }
.theme-toggle:hover { color: var(--ink); background: var(--hairline); }
.i-sun { display: none; }
.is-light .i-moon { display: none; }
.is-light .i-sun { display: block; }

@media (max-width: 26rem) {
  .bar nav a { padding-inline: 0.5rem; }
}
@media (max-width: 24.5rem) {
  .nav-optional { display: none; }
}

/* --- Hero ------------------------------------------------------------------------------------------ */

.hero {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  padding-block: clamp(2.5rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4.5rem);
}

@media (min-width: 56rem) {
  .hero { grid-template-columns: 1.1fr 0.9fr; }
}

.hero-copy { display: grid; gap: 1.25rem; justify-items: start; }

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.25rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.lede {
  max-width: 34rem;
  color: var(--ink-soft);
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  line-height: 1.5;
}

.soon {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.35;
}
.soon .dot {
  width: 0.55rem;
  height: 0.55rem;
  flex: none;
  border-radius: 50%;
  background: var(--soon);
  box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--soon) 22%, transparent);
}

.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.25rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font: 600 1rem/1 var(--text);
  text-decoration: none;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.btn.primary { background: var(--btn-bg); color: var(--btn-ink); }
.btn.ghost { border: 1px solid var(--hairline); color: var(--ink); background: var(--surface); }
.btn:hover { transform: translateY(-1px); }

/* The sky: the logo's overcast gradient with a few drifting clouds (decorative). */
.sky {
  position: relative;
  aspect-ratio: 5 / 4;
  overflow: hidden;
  border-radius: calc(var(--r) + 0.5rem);
  background: linear-gradient(180deg, var(--sky-deep) 0%, var(--sky-top) 45%, var(--sky-bottom) 100%);
  box-shadow: var(--shadow);
}
.sky .sun {
  position: absolute;
  right: 12%;
  top: 10%;
  width: 45%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 247, 226, 0.5), rgba(255, 247, 226, 0));
}
.cloud { position: absolute; fill: var(--cloud); }
.c1 { width: 58%; left: 30%; top: 30%; }
.c2 { width: 30%; left: 6%; top: 12%; opacity: 0.5; }
.c3 { width: 26%; left: 10%; top: 66%; opacity: 0.65; }

@media (prefers-reduced-motion: no-preference) {
  .c1 { animation: drift 18s ease-in-out infinite alternate; }
  .c2 { animation: drift 24s ease-in-out -6s infinite alternate-reverse; }
  .c3 { animation: drift 21s ease-in-out -3s infinite alternate; }
}
@keyframes drift { from { translate: -4% 0; } to { translate: 6% 0; } }

/* --- Sections -------------------------------------------------------------------------------------- */

.section { padding-block: clamp(2rem, 5vw, 3.5rem); }

.section-title {
  margin-bottom: 1.5rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.principles {
  display: grid;
  gap: 1rem;
}
@media (min-width: 46rem) {
  .principles { grid-template-columns: repeat(3, 1fr); }
}
.principles li {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  padding: 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.principles svg { width: 1.75rem; height: 1.75rem; color: var(--accent); }
.principles h3 { font-size: 1.25rem; letter-spacing: -0.02em; }
.principles p { color: var(--muted); }

.prose { display: grid; gap: 1rem; max-width: 42rem; color: var(--ink-soft); font-size: 1.1rem; }

/* Released apps (rendered by build.py from content/apps.json only when an app is released). */
.apps { display: grid; gap: 1rem; }
@media (min-width: 46rem) {
  .apps { grid-template-columns: repeat(2, 1fr); }
}
.app {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  padding: 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.app img, .app-glyph {
  width: 4rem;
  height: 4rem;
  flex: none;
  border-radius: 1rem;
  box-shadow: 0 0 0 1px var(--hairline);
}
.app-glyph { background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom)); }
.app > div { display: grid; gap: 0.35rem; min-width: 0; }
.app h3 { font-size: 1.3rem; letter-spacing: -0.02em; }
.app p { color: var(--ink-soft); }
.app .platform { color: var(--muted); font-size: 0.9rem; }
.app-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.app-link svg { width: 1rem; height: 1rem; }
.app-link:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* --- Contact --------------------------------------------------------------------------------------- */

.contact {
  display: grid;
  justify-items: start;
  gap: 1rem;
  padding: clamp(1.75rem, 5vw, 3.5rem);
  border-radius: calc(var(--r) + 0.5rem);
  background: linear-gradient(160deg, var(--sky-deep), var(--sky-top) 70%, var(--sky-bottom));
  color: #fbfaf7;
}
.contact h2 { color: inherit; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.04em; }
.contact p { max-width: 34rem; color: rgba(251, 250, 247, 0.88); font-size: 1.1rem; }
.email {
  display: inline-block;
  max-width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: #fbfaf7;
  color: #0b0d12;
  font: 650 clamp(1rem, 3.6vw, 1.25rem)/1.2 var(--sans);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.email:hover { background: #ffffff; }
.contact :focus-visible { outline-color: #fbfaf7; }

/* --- Footer ---------------------------------------------------------------------------------------- */

.site-footer { margin-top: 1rem; border-top: 1px solid var(--hairline); }
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 1.75rem calc(1.75rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.92rem;
}
.foot ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.foot a { color: var(--ink-soft); text-underline-offset: 0.2em; }
.foot a:hover { color: var(--ink); }

/* --- 404 ------------------------------------------------------------------------------------------- */

.lost {
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 1.1rem;
  min-height: 70vh;
  padding-block: 4rem;
}
.lost h1 { font-size: clamp(2.5rem, 7vw, 4rem); letter-spacing: -0.045em; line-height: 1.05; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
  .btn:hover { transform: none; }
}

@media (forced-colors: active) {
  .soon .dot, .app-glyph { forced-color-adjust: none; }
  .contact, .sky { border: 1px solid CanvasText; }
}
