/*
 * CloudOmen geçici sitesi. Değerler uygulamanın v2 token'larından (DESIGN.md §2–§4):
 * faz paletleri `src/theme/phases.ts` PHASE_PALETTES, mürekkep INKS, panel zemini
 * `phaseSurface()` çıktısı, bulut dolgusu markın kuralı (cloudLight ile INKS.light'ın ortası).
 * Faz `site.js`'te ziyaretçinin saatinden hesaplanır; JS yoksa gece.
 */

:root,
:root[data-phase='night'] {
  --zenith: #050a1c;
  --horizon: #1b2552;
  --cloud-light: #8f9ac6;
  --cloud-fill: #c2c8e3;
  --sun: #f4ebc9;
  --sun-x: 84%;
  --sun-y: 14%;
  --moon: 1;
  --glow: 18%;
  --ink: #f4f6ff;
  --on-ink: #0d1633;
  --surface: #050816;
}
:root[data-phase='blue'] {
  --zenith: #141d4e;
  --horizon: #6674b6;
  --cloud-light: #e7c9df;
  --cloud-fill: #eee0ef;
  --sun: #ffb3c4;
  --sun-x: 30%;
  --sun-y: 125%;
  --moon: 0;
  --glow: 55%;
  --ink: #f4f6ff;
  --on-ink: #0d1633;
  --surface: #0c122f;
}
:root[data-phase='dawn'] {
  --zenith: #2a3566;
  --horizon: #f3a8a0;
  --cloud-light: #ffe0d6;
  --cloud-fill: #faebeb;
  --sun: #ffb08a;
  --sun-x: 88%;
  --sun-y: 60%;
  --moon: 0;
  --glow: 55%;
  --ink: #0d1633;
  --on-ink: #f4f6ff;
  --surface: #f9d3d0;
}
:root[data-phase='day'] {
  --zenith: #2a66bb;
  --horizon: #cfe6f6;
  --cloud-light: #ffffff;
  --cloud-fill: #fafbff;
  --sun: #fff1cf;
  --sun-x: -25%;
  --sun-y: 95%;
  --moon: 0;
  --glow: 55%;
  --ink: #0d1633;
  --on-ink: #f4f6ff;
  --surface: #e7f3fb;
}
:root[data-phase='golden'] {
  --zenith: #4a5fa2;
  --horizon: #f6b274;
  --cloud-light: #ffe2b8;
  --cloud-fill: #faecdc;
  --sun: #ffc064;
  --sun-x: 6%;
  --sun-y: 66%;
  --moon: 0;
  --glow: 55%;
  --ink: #0d1633;
  --on-ink: #f4f6ff;
  --surface: #fbd9ba;
}

:root {
  /* Gökyüzünün tepesindeki yazı her fazda açık mürekkep: beş zenith'in hepsinde ≥ 5,8:1. */
  --sky-ink: #f4f6ff;
  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'TikTok Sans', system-ui, sans-serif;
  /* spacing / radius: src/theme/tokens.json */
  --s-xs: 4px;
  --s-sm: 8px;
  --s-md: 16px;
  --s-lg: 24px;
  --s-xl: 32px;
  --s-2xl: 48px;
  --s-3xl: 64px;
  --r-lg: 24px;
  --gutter: 16px;
  color-scheme: dark;
}
:root[data-phase='dawn'],
:root[data-phase='day'],
:root[data-phase='golden'] {
  color-scheme: light;
}

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

html {
  background: var(--surface);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  display: flex;
  flex-direction: column;
}

/* ---------- Gökyüzü ---------- */

.sky {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(
      circle min(60vmax, 640px) at var(--sun-x) var(--sun-y),
      color-mix(in srgb, var(--sun) var(--glow), transparent) 0,
      transparent 100%
    ),
    linear-gradient(to bottom, var(--zenith) 0%, var(--zenith) 18%, var(--horizon) 100%);
}

.sky__moon {
  position: absolute;
  left: var(--sun-x);
  top: var(--sun-y);
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 28px 6px color-mix(in srgb, var(--sun) 35%, transparent);
  opacity: var(--moon);
}

.sky__mark {
  position: absolute;
  pointer-events: none;
}
.sky__mark .ring {
  stroke: var(--cloud-light);
}
.sky__mark .cloud {
  fill: var(--cloud-fill);
}
.sky__mark .pen {
  fill: var(--sky-ink);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  padding: var(--s-md) var(--gutter);
  color: var(--sky-ink);
  text-decoration: none;
  width: max-content;
}
.topbar img {
  width: 32px;
  height: 32px;
}
.topbar span {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  line-height: 24px;
}

/* ---------- Panel ---------- */

.panel {
  position: relative;
  z-index: 1;
  flex: 1;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  margin-top: calc(-1 * var(--r-lg));
  padding: var(--s-xl) var(--gutter) var(--s-xl);
}

.panel__inner {
  display: flex;
  flex-direction: column;
  gap: var(--s-lg);
  max-width: 34rem;
}

/* Tek orkestre edilmiş hareket: panelin içeriği bir kez doğar (DESIGN.md §6). */
@media (prefers-reduced-motion: no-preference) {
  .panel__inner {
    animation: emerge 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}
@keyframes emerge {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Metin rolleri: src/theme/textRoles.ts TEXT_ROLES */
.oracle {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  line-height: 35px;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 26px;
  overflow-wrap: anywhere;
  hyphens: auto;
}
p,
ul {
  margin: 0;
}
.secondary {
  font-weight: 300;
}
strong {
  font-weight: 600;
}
.label {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
}
.caption {
  font-size: 12px;
  line-height: 18px;
}

.block {
  display: flex;
  flex-direction: column;
  gap: var(--s-sm);
}

.list {
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: var(--s-xs);
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover {
  text-decoration-thickness: 2px;
}
a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

.soon {
  font-weight: 600;
  line-height: 22px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-xs) var(--s-lg);
  padding-top: var(--s-sm);
}
.footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.footer a[aria-current='page'] {
  text-decoration: none;
  font-weight: 600;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 2;
  padding: var(--s-sm) var(--s-md);
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 8px;
}
.skip:focus {
  top: var(--s-sm);
}

/* ---------- Ana sayfa ---------- */

.home .sky {
  height: 46svh;
  min-height: 300px;
}
.home .sky__mark {
  width: min(78vw, 360px);
  aspect-ratio: 1;
  right: -6vw;
  bottom: calc(var(--r-lg) - 8%);
}

/* ---------- Alt sayfalar (durgun gökyüzü şeridi + opak panel) ---------- */

.still .sky {
  height: 22svh;
  min-height: 140px;
}
.still .sky__mark {
  width: 200px;
  aspect-ratio: 1;
  right: -40px;
  bottom: -70px;
}
.still .panel__inner {
  max-width: 40rem;
}

@media (min-width: 900px) {
  :root {
    --gutter: 48px;
  }
  /* Gökyüzü ve panel aynı ızgara hücresinde: gökyüzü tüm pencere, panel sola ve alta yaslı. */
  .home {
    display: grid;
    grid-template: 1fr / 1fr;
  }
  .home .sky,
  .home .panel {
    grid-area: 1 / 1;
  }
  .home .sky {
    height: auto;
  }
  .home .sky__mark {
    width: min(56vmin, 520px);
    right: 12vw;
    top: 22vh;
    bottom: auto;
  }
  .home .panel {
    align-self: end;
    justify-self: start;
    margin-left: var(--gutter);
    margin-top: var(--s-3xl);
    width: 36rem;
    padding: var(--s-2xl) var(--s-2xl) var(--s-xl);
  }
  .home .oracle {
    font-size: 36px;
    line-height: 44px;
  }
  .still .panel {
    padding-left: var(--gutter);
    padding-top: var(--s-2xl);
  }
}
