:root {
  --ink: #1a2421;
  --muted: #5a6b64;
  --paper: #eef3f0;
  --mist: #d7e4dd;
  --surface: #f7faf8;
  --accent: #0f7a5f;
  --accent-deep: #0a5c47;
  --op: #c45c26;
  --op-deep: #9e4518;
  --eq: #1f4e79;
  --eq-deep: #163a5c;
  --line: rgba(26, 36, 33, 0.12);
  --shadow: 0 18px 40px rgba(26, 36, 33, 0.08);
  --radius: 18px;
  --font-display: "Bricolage Grotesque", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #c8ddd4 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 95% 15%, #dce8e2 0%, transparent 50%),
    linear-gradient(165deg, #e8f0eb 0%, var(--paper) 45%, #e4ebe7 100%);
  line-height: 1.55;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 6vw;
  backdrop-filter: blur(10px);
  background: rgba(238, 243, 240, 0.72);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.site-header nav {
  display: flex;
  gap: 1.5rem;
}

.site-header nav a {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.site-header nav a:hover {
  color: var(--accent);
}

.hero {
  min-height: calc(100vh - 4rem);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 2rem;
  padding: 4rem 6vw 3rem;
  position: relative;
  overflow: hidden;
}

.hero-copy {
  max-width: 34rem;
  animation: rise 0.8s ease both;
}

.brand-mark {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 7.5rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: var(--ink);
}

.hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.lede {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 28rem;
}

.cta {
  display: inline-block;
  padding: 0.85rem 1.4rem;
  background: var(--accent);
  color: #f5fbf8;
  font-weight: 500;
  border-radius: 10px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.cta:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

.hero-visual {
  height: min(58vh, 420px);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(15, 122, 95, 0.18), transparent 45%),
    linear-gradient(25deg, #b7cfc5, #8fb5a6 40%, #6a9b8a 100%);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: fade-in 1s ease 0.15s both;
}

.hero-visual::after {
  content: "";
  position: absolute;
  inset: 18% 22% auto auto;
  width: 42%;
  height: 42%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  filter: blur(2px);
  animation: drift 8s ease-in-out infinite alternate;
}

.about,
.calculator-section {
  padding: 4.5rem 6vw;
  max-width: 720px;
}

.about h2,
.calculator-section h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.03em;
}

.about p,
.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.calculator-section {
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 5rem;
}

.section-note {
  margin-bottom: 2rem;
}

.calculator {
  width: min(100%, 320px);
  padding: 1.1rem;
  background: #111111;
  border: 1px solid #222;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.7s ease both;
}

.display {
  min-height: 4.2rem;
  margin-bottom: 0.9rem;
  padding: 1rem 1.1rem;
  background: #fff;
  color: #111;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  text-align: right;
  overflow-x: auto;
  white-space: nowrap;
}

.keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.key {
  appearance: none;
  border: none;
  min-height: 3.35rem;
  border-radius: 12px;
  background: #2a2a2a;
  color: #f5f5f5;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.key:hover {
  background: #3a3a3a;
}

.key:active {
  transform: scale(0.96);
}

.key-fn {
  background: #1c1c1c;
  color: #b0b0b0;
}

.key-op {
  background: #333;
  color: #ffb347;
}

.key-op:hover {
  background: #444;
}

.key-eq {
  background: #f5f5f5;
  color: #111;
}

.key-eq:hover {
  background: #e0e0e0;
}

.key-zero {
  grid-column: span 2;
}

.site-footer {
  padding: 1.5rem 6vw 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes drift {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(-18px, 22px);
  }
}

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 3rem;
  }

  .hero-visual {
    order: -1;
    height: 220px;
  }

  .brand-mark {
    font-size: clamp(3.2rem, 18vw, 5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-copy,
  .hero-visual,
  .calculator,
  .hero-visual::after {
    animation: none;
  }
}
