:root {
  /*
   * Site color rules
   * Base: warm off-white and charcoal
   * Accents: softened Google-inspired blue, red, yellow, and green
   * Keep UI colors within these tokens; background sketches are harmonized separately.
   */
  --bg: #fbfaf7;
  --surface: rgba(255, 255, 255, 0.82);
  --text: #292b2f;
  --muted: #6f7378;
  --line: #e4e3df;
  --accent: #5279bd;
  --accent-hover: #3f66a8;
  --accent-soft: #e8eff9;
  --blue: #7899d0;
  --red: #d9827b;
  --yellow: #e7c66f;
  --green: #79ad8b;
  --shadow: 0 14px 42px rgba(54, 64, 78, 0.08);
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 8px;
  font-family:
    "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 4%, rgba(120, 153, 208, 0.1), transparent 28%),
    radial-gradient(circle at 94% 14%, rgba(217, 130, 123, 0.08), transparent 25%),
    linear-gradient(180deg, #fbfaf7 0%, #f8f8f5 100%);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

#p5-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  opacity: 0;
  background:
    radial-gradient(circle at 16% 18%, var(--blue), transparent 34%),
    radial-gradient(circle at 84% 12%, var(--red), transparent 32%),
    radial-gradient(circle at 76% 82%, var(--yellow), transparent 36%),
    radial-gradient(circle at 22% 78%, var(--green), transparent 34%), var(--bg);
  transition: opacity 1.5s ease-in;
}
#p5-bg.loaded {
  opacity: 0.18;
}
#p5-bg canvas {
  position: absolute;
  top: 50%;
  left: 54%;
  display: block;
  width: max(100vw, 100vh) !important;
  height: max(100vw, 100vh) !important;
  transform: translate(-50%, -50%);
  /*
   * Preserve each sketch as a square artboard and crop its outer edges like
   * background-size: cover. The sketch supplies luminance and shape while the
   * shared pastel backdrop supplies the site-wide color harmony.
   */
  mix-blend-mode: luminosity;
  filter: contrast(0.9) saturate(0.75);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(24px, 4vw, 56px);
  background: rgba(251, 250, 247, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  color: var(--muted);
}

/* Hamburger Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 30;
}
.menu-toggle .bar {
  width: 100%;
  height: 2px;
  background-color: var(--text);
  transition: all 0.3s ease;
  transform-origin: 1px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  font-family: var(--font-mono);
  transition: color 160ms ease;
}
.nav a:hover {
  color: var(--text);
}

.section-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
}

.hero {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 100px 0;
}

.eyebrow {
  color: var(--accent);
  margin: 0 0 16px;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 24px;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.2;
  letter-spacing: -0.04em;
  font-weight: 700;
}
h2 {
  margin-bottom: 24px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.3;
  letter-spacing: -0.03em;
  font-weight: 700;
}
h3 {
  font-size: 20px;
  margin-bottom: 12px;
  font-weight: 600;
}
p {
  color: var(--muted);
  line-height: 1.8;
}
.lead {
  max-width: 690px;
  font-size: clamp(16px, 1.8vw, 18px);
  color: var(--text);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 40px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-mono);
  transition: all 200ms ease;
}
.button.primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(82, 121, 189, 0.2);
}
.button.primary:hover {
  background: var(--accent-hover);
}
.button.ghost {
  color: var(--text);
  border: 1px solid #d9dce1;
  background: rgba(255, 255, 255, 0.55);
}
.button.ghost:hover {
  color: var(--accent-hover);
  border-color: #bccce5;
  background: var(--accent-soft);
}
.mt-4 {
  margin-top: 24px;
}

.feature-card {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition:
    transform 300ms ease,
    box-shadow 300ms ease;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.card-number {
  display: block;
  margin-bottom: 16px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 14px;
}

.split-section,
.creative-section,
.closing-section {
  padding: 100px 0;
}
.split-section {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
}
.card-grid {
  display: grid;
  gap: 24px;
}

.creative-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
}
.creative-copy p {
  max-width: 600px;
}
.code-card {
  border: 1px solid rgba(82, 121, 189, 0.18);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #30343c;
  box-shadow: var(--shadow);
}
pre {
  margin: 0;
  padding: 32px;
  color: #edf2fa;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
}
code {
  font-family: var(--font-mono);
}

.about-grid {
  max-width: 800px;
}
.profile-list {
  margin: 32px 0 0;
  display: grid;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.profile-list div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}
dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 14px;
}
dd {
  margin: 0;
  text-align: right;
  font-weight: 500;
}
dd a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--text);
  padding-bottom: 2px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 40px clamp(24px, 4vw, 56px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
}
.site-footer p {
  margin: 0;
  font-size: 12px;
}

/* Fade-in Animation */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.8s ease-out,
    transform 0.8s ease-out;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 850px) {
  #p5-bg canvas {
    left: 50%;
  }

  .menu-toggle {
    display: flex;
  }
  .nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: var(--bg);
    flex-direction: column;
    justify-content: center;
    transition: right 0.4s cubic-bezier(0.77, 0.2, 0.05, 1);
    z-index: 25;
  }
  .nav.active {
    right: 0;
  }
  .nav a {
    font-size: 24px;
  }

  /* Animate hamburger to cross */
  .menu-toggle.active .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle.active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -8px);
  }

  .split-section,
  .creative-section {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 60px 0;
  }
  .site-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .profile-list div {
    flex-direction: column;
    gap: 4px;
    text-align: left;
  }
  .profile-list dd {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  #p5-bg {
    display: none;
  }
  .fade-in {
    opacity: 1;
    transform: none;
  }
}
