/* ============================================================
   Kaizen Works — styles
   A calm, editorial, Japanese-minimalist landing page.
   ============================================================ */

/* ---------- Theme tokens ---------- */
:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #efeae0;
  --ink: #1b1a17;
  --muted: #6c685f;
  --line: rgba(27, 26, 23, 0.1);
  --accent: #df4a2c;
  --accent-soft: rgba(223, 74, 44, 0.12);

  --blob-1: rgba(223, 74, 44, 0.16);
  --blob-2: rgba(120, 140, 200, 0.16);
  --grain-opacity: 0.04;

  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;

  --maxw: 1120px;
  --radius: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #100f0d;
  --surface: #1a1916;
  --surface-2: #211f1b;
  --ink: #f3efe6;
  --muted: #a09b8f;
  --line: rgba(243, 239, 230, 0.12);
  --accent: #ff6a4a;
  --accent-soft: rgba(255, 106, 74, 0.16);

  --blob-1: rgba(255, 106, 74, 0.18);
  --blob-2: rgba(110, 130, 210, 0.2);
  --grain-opacity: 0.05;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--accent);
  color: #fff;
}

em {
  font-style: italic;
  color: var(--accent);
}

/* ---------- Background decoration ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.9;
  will-change: transform;
}

.blob--1 {
  top: -14vw;
  right: -10vw;
  background: var(--blob-1);
}

.blob--2 {
  bottom: -16vw;
  left: -12vw;
  background: var(--blob-2);
}

.grain {
  position: absolute;
  inset: -200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
}

html[data-theme="dark"] .grain {
  mix-blend-mode: screen;
}

/* ---------- Layout helpers ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(5rem, 12vw, 9rem) clamp(1.5rem, 5vw, 3rem);
}

.section__index {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.4rem;
}

.section__head {
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

h2 {
  font-family: var(--font-serif);
  font-weight: 380;
  font-size: clamp(2.1rem, 5.5vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1.5rem, 5vw, 3rem);
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease),
    backdrop-filter 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}

.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.brand__mark {
  width: 26px;
  height: 26px;
  color: var(--accent);
  transition: transform 0.6s var(--ease);
}

.brand:hover .brand__mark {
  transform: rotate(35deg);
}

.nav__links {
  display: flex;
  gap: 2rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.nav__links a {
  position: relative;
  transition: color 0.25s var(--ease);
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.nav__links a:hover {
  color: var(--ink);
}

.nav__links a:hover::after {
  transform: scaleX(1);
}

/* Theme toggle */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease),
    background 0.3s var(--ease);
}

.theme-toggle:hover {
  transform: rotate(18deg);
  border-color: var(--accent);
}

.theme-toggle .icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.icon--moon { display: none; }
html[data-theme="dark"] .icon--sun { display: none; }
html[data-theme="dark"] .icon--moon { display: block; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(9rem, 22vw, 14rem) clamp(1.5rem, 5vw, 3rem)
    clamp(4rem, 10vw, 7rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.45rem 0.9rem 0.45rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--surface);
  margin-bottom: 1.8rem;
}

.eyebrow .kanji {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0;
}

.hero__title {
  font-family: var(--font-serif);
  font-weight: 340;
  font-size: clamp(2.8rem, 8.5vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  max-width: 14ch;
}

.hero__lead {
  margin-top: 1.8rem;
  max-width: 46ch;
  font-size: clamp(1.05rem, 2.4vw, 1.28rem);
  color: var(--muted);
  font-weight: 300;
}

.hero__actions {
  margin-top: 2.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.status {
  margin-top: 2.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e07b39;
}

.hero__glyph {
  position: absolute;
  top: 50%;
  right: clamp(-2rem, 2vw, 2rem);
  transform: translateY(-46%);
  font-family: var(--font-serif);
  font-size: clamp(12rem, 34vw, 30rem);
  line-height: 1;
  color: var(--accent);
  opacity: 0.07;
  pointer-events: none;
  user-select: none;
  z-index: -1;
  will-change: transform;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.5rem;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
    border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}

.btn--ghost {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Philosophy ---------- */
.philosophy__text {
  font-family: var(--font-serif);
  font-weight: 340;
  font-size: clamp(1.4rem, 3.6vw, 2.2rem);
  line-height: 1.4;
  max-width: 24ch;
  letter-spacing: -0.01em;
}

.philosophy {
  max-width: var(--maxw);
}

.philosophy .section__head { margin-bottom: 2.5rem; }

/* ---------- Bento grid ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(0.9rem, 1.6vw, 1.2rem);
}

.card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.6rem, 3vw, 2.4rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 200px;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease),
    box-shadow 0.4s var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 24px 50px -28px rgba(0, 0, 0, 0.28);
}

.card h3 {
  font-family: var(--font-serif);
  font-weight: 420;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 0.7rem;
}

.card p {
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 42ch;
}

.card__tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.32rem 0.7rem;
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  border-radius: 100px;
}

.card__top {
  margin-bottom: auto;
  padding-bottom: 2.5rem;
}

.card--feature {
  grid-column: span 3;
  grid-row: span 2;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--accent) 12%, var(--surface)),
    var(--surface) 60%
  );
}

.card--wide { grid-column: span 3; }

.card--small {
  grid-column: span 2;
  min-height: 0;
}

.card--small p {
  font-size: 0.9rem;
}

.card__glyph {
  position: absolute;
  top: -1.5rem;
  right: -0.5rem;
  font-family: var(--font-serif);
  font-size: 11rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.12;
  user-select: none;
}

.card__stat {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 380;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.7rem;
}

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1.4rem 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee__track {
  display: inline-flex;
  align-items: center;
  gap: 2.5rem;
  white-space: nowrap;
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 330;
  color: var(--ink);
  animation: scroll 26s linear infinite;
}

.marquee__track .dot { color: var(--accent); }

@keyframes scroll {
  to { transform: translateX(-50%); }
}

/* ---------- Contact ---------- */
.contact {
  text-align: center;
  max-width: 880px;
}

.contact__title {
  font-family: var(--font-serif);
  font-weight: 360;
  font-size: clamp(2.3rem, 7vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0.5rem auto 0;
}

.contact__lead {
  margin: 1.6rem auto 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 300;
}

.contact__mail {
  display: inline-block;
  margin-top: 2.6rem;
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 380;
  border-bottom: 2px solid var(--accent-soft);
  padding-bottom: 0.25rem;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.contact__mail:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
}

.footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.4rem clamp(1.5rem, 5vw, 3rem);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.footer__meta {
  font-size: 0.86rem;
  color: var(--muted);
}

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--d, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .nav__links { display: none; }

  .card--feature,
  .card--wide { grid-column: 1 / -1; }

  .card--feature { grid-row: auto; }

  .card--small { grid-column: span 3; }
}

@media (max-width: 560px) {
  .bento { grid-template-columns: 1fr; }
  .card--small { grid-column: 1 / -1; }
  .card { min-height: 170px; }
  .hero__glyph { opacity: 0.05; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
