/* base.css — INFRA-owned shared styles (SPEC §4 typography, §5 layout,
   §6.1 header, §6.2 footer, §6.3 status pill, §6.4 phone frame,
   §8.4 sky-engine CSS half, §8.7 press states, §8.8 reduced motion). */

/* ---------- reset-lite ---------- */

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

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

body,
h1,
h2,
h3,
p,
figure,
blockquote,
dl,
dd,
ul,
ol {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

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

img {
  height: auto;
}

/* ---------- §4 typography + §8.4 body sky transition ---------- */

body {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--page-fg);
  background-color: var(--sky-dawn);
  transition: background-color 900ms var(--ease-soft), color 900ms var(--ease-soft);
}

html[lang="ja"] body {
  line-height: 1.9;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 6.4vw, 76px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--page-fg);
}

html[lang="ja"] h1 {
  line-height: 1.3;
  letter-spacing: 0;
  font-feature-settings: "palt";
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4.2vw, 46px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--page-fg);
}

html[lang="ja"] h2 {
  line-height: 1.4;
  letter-spacing: 0;
  font-feature-settings: "palt";
}

/* progressive enhancement; harmless where unsupported */
html[lang="ja"] h1,
html[lang="ja"] h2 {
  word-break: auto-phrase;
}

.kicker {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.14em;
  color: var(--page-kicker);
}

html[lang="en"] .kicker {
  text-transform: uppercase;
}

.lead {
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 400;
  line-height: 1.6;
  color: var(--page-fg-2);
  max-width: 560px;
}

html[lang="ja"] .lead {
  line-height: 1.9;
}

.body-text {
  max-width: 34em;
  color: var(--page-fg-2);
}

.caption,
figcaption {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--fg-3);
}

/* Text colors cross-fade with the sky (§8.4). */
h1,
h2,
h3,
p,
li,
dt,
dd,
figcaption,
.kicker,
.lead {
  transition: color 900ms var(--ease-soft);
}

/* ---------- §5 layout ---------- */

.container {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 48px);
}

.container--narrow {
  max-width: 720px;
}

.section {
  padding-block: clamp(88px, 13vh, 152px);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }

  .grid--visual-left {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }

  .grid--visual-left > .section-copy {
    order: 2;
  }

  .grid--visual-left > .section-visual {
    order: 1;
  }
}

/* ---------- skip link (first element in body) ---------- */

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--bg-card);
  color: var(--fg);
  font: 600 14px var(--font-body);
  text-decoration: none;
  box-shadow: var(--shadow-2);
}

.skip-link:focus {
  top: 16px;
}

/* ---------- §6.1 header ---------- */

.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  height: 72px;
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  height: 34px;
  width: auto;
  transition: opacity var(--dur-base);
}

.brand-logo--dark {
  position: absolute;
  inset: 0;
  opacity: 0;
}

body[data-phase="dusk"] .brand-logo--light,
body[data-phase="night"] .brand-logo--light {
  opacity: 0;
}

body[data-phase="dusk"] .brand-logo--dark,
body[data-phase="night"] .brand-logo--dark {
  opacity: 1;
}

.lang-toggle {
  font: 600 13px/1 var(--font-body);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  backdrop-filter: blur(12px) saturate(1.05);
  color: var(--page-fg);
  text-decoration: none;
  transition: color 900ms var(--ease-soft), border-color 900ms var(--ease-soft), transform 120ms var(--ease-out);
}

body[data-phase="dusk"] .lang-toggle,
body[data-phase="night"] .lang-toggle {
  border-color: var(--night-line);
}

/* ---------- §6.2 footer (paints its own --bg-soft regardless of phase) ---------- */

.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  padding-block: 64px 40px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand img {
  width: 28px;
  height: 28px;
}

.footer-wordmark {
  font: 600 13px var(--font-body);
  letter-spacing: 3px;
  color: var(--fg-3);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-nav a {
  font: 500 15px var(--font-body);
  color: var(--fg-2);
  text-decoration: none;
}

.footer-note,
.footer-copyright {
  font-size: 13px;
  color: var(--fg-3);
  transition: none;
}

/* ---------- §6.3 status pill ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 14px/1 var(--font-body);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--bg-card);
  color: var(--sun-500);
  border: 1px solid var(--sun-200);
  box-shadow: var(--shadow-1);
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sun-300);
}

/* ---------- §6.4 phone frame ---------- */

.phone {
  width: clamp(230px, 26vw, 310px);
  margin: 0;
}

/* The 9px frame is a border so the outer radius (clamp) and the inner image
   radius (clamp − 9px) both hold on a single <img> element. */
.phone img {
  display: block;
  width: 100%;
  height: auto;
  border: 9px solid #1B1A1F;
  border-radius: clamp(30px, 3vw, 40px);
  background: #1B1A1F;
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

@media (min-width: 900px) {
  .phone--tilt-l {
    transform: rotate(-3deg);
  }

  .phone--tilt-r {
    transform: rotate(2.5deg);
  }
}

.phone figcaption {
  text-align: center;
  margin-top: 16px;
}

/* ---------- §8.4 sky phase engine (CSS half; JS lives in main.js) ---------- */

body[data-phase="day"] {
  background-color: var(--sky-day);
}

body[data-phase="afternoon"] {
  background-color: var(--sky-afternoon);
}

body[data-phase="evening"] {
  background-color: var(--sky-evening);
}

body[data-phase="dusk"] {
  background-color: var(--sky-dusk);
}

body[data-phase="night"] {
  background-color: var(--sky-night);
}

body[data-phase="dusk"],
body[data-phase="night"] {
  --page-fg: var(--night-fg);
  --page-fg-2: var(--night-fg-2);
  --page-kicker: var(--sun-200);
}

/* ---------- §8.7 press states ---------- */

a,
button {
  transition: transform 120ms var(--ease-out);
}

a:active,
button:active {
  transform: scale(0.97);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- §8.8 reduced motion (mandatory, keep last) ---------- */

@media (prefers-reduced-motion: reduce) {
  .rays, .img-placeholder, [class*="star"] { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  body { transition: none; }
}
