/* =====================================================
   YAGIREF — DESIGN TOKENS
   ===================================================== */
:root {
  --bg: #F1F1ED;
  --ink: #111111;
  --ink-soft: #6B6B66;
  --line: #D5D5CF;
  --accent: #D8FF00;
  --dark: #111111;
  --dark-line: #2A2A26;

  --font-main: 'Manrope', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --gutter: clamp(24px, 5vw, 64px);
  --max: 1400px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-main);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

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

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* =====================================================
   BACKGROUND GRID — subtle technical grid, fixed
   ===================================================== */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 88px 88px;
  opacity: 0.35;
  mask-image: linear-gradient(to bottom, black, black 60%, transparent 100%);
}

/* =====================================================
   SHARED SECTION GRID
   Two-column: fixed meta rail + fluid content
   ===================================================== */
.section-grid {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 120px var(--gutter);
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 40px;
}

.section-meta {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
  height: fit-content;
  position: sticky;
  top: 120px;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

@media (max-width: 860px) {
  .section-grid {
    grid-template-columns: 1fr;
    padding: 80px var(--gutter);
    gap: 28px;
  }
  .section-meta { position: static; }
}

/* =====================================================
   NAVIGATION
   ===================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(241, 241, 237, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  gap: 40px;
}

.nav-links a {
  font-size: 14px;
  color: var(--ink-soft);
  transition: color 0.2s ease;
  position: relative;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 1px;
  background: var(--ink);
  width: 100%;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.active span:nth-child(1) { transform: translateY(3px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { transform: translateY(-3px) rotate(-45deg); }

@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    top: 65px;
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }
  .nav-links.open { max-height: 300px; }
  .nav-links a {
    padding: 18px var(--gutter);
    border-top: 1px solid var(--line);
    color: var(--ink);
  }
  .nav-toggle { display: flex; }
}

/* =====================================================
   SECTION 01 — HERO
   ===================================================== */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 140px var(--gutter) 40px;
  max-width: var(--max);
  margin: 0 auto;
}

.hero-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 24px;
}

.hero-headline {
  font-size: clamp(56px, 11vw, 148px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.02em;
}

.hero-headline .line {
  display: block;
  overflow: hidden;
}

.hero-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-top: 60px;
  flex-wrap: wrap;
}

.hero-sub {
  max-width: 420px;
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 18px 30px;
  white-space: nowrap;
  transition: background 0.25s ease, color 0.25s ease;
  border: 1px solid var(--ink);
}

.btn-primary:hover {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}

.hero-diagram {
  width: 100%;
  max-width: 720px;
  margin: 70px auto 0;
}

.hero-diagram-svg { width: 100%; height: auto; display: block; }

.d-line {
  stroke: var(--line);
  stroke-width: 1;
}

.d-node circle {
  fill: var(--bg);
  stroke: var(--ink);
  stroke-width: 1.4;
}

.d-node-center circle {
  fill: var(--accent);
  stroke: var(--ink);
}

.d-label {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--ink-soft);
  letter-spacing: 0.03em;
}

.d-label-center {
  fill: var(--ink);
  font-weight: 700;
  font-size: 13px;
}

.hero-scroll {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 60px;
}

.scroll-line {
  width: 40px;
  height: 1px;
  background: var(--ink-soft);
}

/* =====================================================
   SECTION 02 — INTRO
   ===================================================== */
.intro-headline {
  font-size: clamp(30px, 4.6vw, 54px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  max-width: 780px;
}

.intro-text {
  margin-top: 34px;
  max-width: 540px;
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.7;
}

/* =====================================================
   SECTION 03 — CAPABILITIES (horizontal list, not cards)
   ===================================================== */
.cap-list {
  border-top: 1px solid var(--line);
}

.cap-item {
  display: grid;
  grid-template-columns: 60px 1fr 1fr 40px;
  align-items: center;
  gap: 30px;
  padding: 36px 24px;
  border-bottom: 1px solid var(--line);
  transition: background 0.3s ease, color 0.3s ease, padding 0.3s ease;
  cursor: default;
}

.cap-item:hover {
  background: var(--ink);
  color: var(--bg);
  padding-left: 40px;
}

.cap-item:hover .cap-desc { color: #B9B9B4; }
.cap-item:hover .cap-num { color: var(--accent); }

.cap-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  transition: color 0.3s ease;
}

.cap-title {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cap-desc {
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 400px;
  transition: color 0.3s ease;
}

.cap-arrow {
  font-size: 22px;
  justify-self: end;
  transition: transform 0.3s ease;
}

.cap-item:hover .cap-arrow { transform: translate(4px, -4px); }

@media (max-width: 860px) {
  .cap-item {
    grid-template-columns: 40px 1fr;
    grid-template-areas:
      "num arrow"
      "title title"
      "desc desc";
    row-gap: 12px;
  }
  .cap-num { grid-area: num; }
  .cap-arrow { grid-area: arrow; }
  .cap-title { grid-area: title; }
  .cap-desc { grid-area: desc; max-width: 100%; }
  .cap-item:hover { padding-left: 24px; }
}

/* =====================================================
   SECTION 04 — SYSTEM ARCHITECTURE (interactive diagram)
   ===================================================== */
.arch-headline {
  font-size: clamp(28px, 4.2vw, 48px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  max-width: 680px;
  margin-bottom: 60px;
}

.arch-diagram-wrap {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 60px;
  align-items: start;
}

.arch-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
  display: block;
}

.arch-spine {
  stroke: var(--line);
  stroke-width: 1;
}

.arch-dot {
  fill: var(--bg);
  stroke: var(--ink-soft);
  stroke-width: 1.4;
  transition: fill 0.25s ease, stroke 0.25s ease, r 0.25s ease;
}

.arch-text {
  font-family: var(--font-mono);
  font-size: 15px;
  fill: var(--ink-soft);
  letter-spacing: 0.02em;
  transition: fill 0.25s ease;
}

.arch-node {
  cursor: pointer;
  outline: none;
}

.arch-node:hover .arch-dot,
.arch-node:focus-visible .arch-dot,
.arch-node.active .arch-dot {
  fill: var(--accent);
  stroke: var(--ink);
}

.arch-node:hover .arch-text,
.arch-node:focus-visible .arch-text,
.arch-node.active .arch-text {
  fill: var(--ink);
}

.arch-detail {
  border-left: 1px solid var(--line);
  padding: 4px 0 4px 34px;
  min-height: 120px;
  align-self: center;
}

.arch-detail-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.arch-detail-text {
  font-size: 19px;
  line-height: 1.55;
  max-width: 420px;
  transition: opacity 0.2s ease;
}

@media (max-width: 860px) {
  .arch-diagram-wrap { grid-template-columns: 1fr; gap: 40px; }
  .arch-detail { border-left: none; border-top: 1px solid var(--line); padding: 24px 0 0; }
}

/* =====================================================
   SECTION 05 — APPROACH (dark)
   ===================================================== */
.approach {
  background: var(--dark);
  color: var(--bg);
  position: relative;
  z-index: 1;
}

.approach .section-num,
.approach .section-label {
  color: #8B8B85;
}

.approach-headline {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 70px;
}

.process-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--dark-line);
}

.process-item {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 34px 24px 34px 0;
  border-right: 1px solid var(--dark-line);
}

.process-item:last-child { border-right: none; }

.process-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

.process-title {
  font-size: 22px;
  font-weight: 700;
}

.process-desc {
  font-size: 14px;
  color: #A6A6A0;
  line-height: 1.6;
}

@media (max-width: 860px) {
  .process-list { grid-template-columns: 1fr; }
  .process-item {
    border-right: none;
    border-bottom: 1px solid var(--dark-line);
    padding: 28px 0;
  }
  .process-item:last-child { border-bottom: none; }
}

/* =====================================================
   SECTION 06 — TECHNOLOGY STACK
   ===================================================== */
.stack-headline {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 60px;
}

.stack-groups {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}

.stack-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 30px 24px 30px 0;
  border-right: 1px solid var(--line);
}

.stack-group:last-child { border-right: none; }

.stack-group-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.stack-item {
  font-size: 16px;
  font-weight: 500;
}

@media (max-width: 860px) {
  .stack-groups { grid-template-columns: 1fr 1fr; }
  .stack-group:nth-child(2n) { border-right: none; }
  .stack-group { border-bottom: 1px solid var(--line); }
}

@media (max-width: 540px) {
  .stack-groups { grid-template-columns: 1fr; }
  .stack-group { border-right: none; }
}

/* =====================================================
   SECTION 07 — CONTACT (accent)
   ===================================================== */
.contact {
  background: var(--accent);
  color: var(--ink);
  position: relative;
  z-index: 1;
}

.contact-pre {
  font-size: 15px;
  margin-bottom: 30px;
  color: #4A5200;
}

.contact-headline {
  font-size: clamp(38px, 7vw, 84px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-bottom: 60px;
}

.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 700;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
}

.contact-arrow {
  font-size: 28px;
  transition: transform 0.25s ease;
}

.contact-email:hover .contact-arrow {
  transform: translate(6px, -6px);
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
  background: var(--dark);
  color: #8B8B85;
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-logo {
  font-weight: 800;
  font-size: 14px;
  color: var(--bg);
  letter-spacing: 0.04em;
}

.footer-meta {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* =====================================================
   SCROLL REVEAL ANIMATIONS
   ===================================================== */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in { opacity: 1; transform: translateY(0); }

.hero-headline .line.reveal { transform: translateY(100%); }
.hero-headline .line.reveal.in { transform: translateY(0); }

.reveal-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-up.in { opacity: 1; transform: translateY(0); }
