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

:root {
  --bg-stage: #d8dce6;
  --bg-card: #e8ebf2;
  --fg: #1a1612;
  --muted: #a89e92;
  --accent: #c07f52;
  --ghost-stroke: #dcd5cc80;
  --rule: rgba(26, 22, 18, 0.1);
}

html, body { width: 100%; min-height: 100%; }
body {
  background: var(--bg-stage);
  font-family: 'Space Grotesk', sans-serif;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes cardHue {
  0%   { background: #e8ebf2; }
  12.5%  { background: #eae8f2; }
  25%  { background: #ece8f2; }
  37.5%  { background: #eae8f2; }
  50%  { background: #e8ebf2; }
  62.5%  { background: #e8f0f2; }
  75%  { background: #e8f2f2; }
  87.5%  { background: #e8f0f2; }
  100% { background: #e8ebf2; }
}
@keyframes accentHue {
  0%   { color: #c07f52; }
  12.5%  { color: #c09952; }
  25%  { color: #c0a452; }
  37.5%  { color: #c09952; }
  50%  { color: #c07f52; }
  62.5%  { color: #c06552; }
  75%  { color: #c05a52; }
  87.5%  { color: #c06552; }
  100% { color: #c07f52; }
}

.stage {
  width: 100%; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}

.page {
  width: min(820px, 92vw);
  height: min(540px, 88vh);
  display: flex; flex-direction: column;
  justify-content: space-between;
  padding: 44px 56px;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.13), 0 1px 4px rgba(0, 0, 0, 0.07);
  background: var(--bg-card);
  animation: cardHue 25s ease-in-out infinite;
}

/* Ghost background text */
.ghost {
  position: absolute;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 260px;
  color: transparent;
  line-height: 0.82;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  -webkit-text-stroke: 1px var(--ghost-stroke);
  user-select: none;
  pointer-events: none;
  animation: fadeIn 1.2s ease both;
}

/* Top bar */
.top {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: flex-start;
  animation: fadeUp 0.7s 0.1s ease both;
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px; font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.index {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.06em;
  color: var(--muted);
}

/* Center */
.center {
  position: relative; z-index: 1;
  animation: fadeUp 0.7s 0.25s ease both;
}
.line1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 52px;
  line-height: 1.05;
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--fg);
}
.line2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 52px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
}
.line2 .accent {
  color: var(--accent);
  animation: accentHue 25s ease-in-out infinite;
}
.meta {
  font-family: 'DM Mono', monospace;
  font-size: 12px; letter-spacing: 0.03em;
  line-height: 1.8;
  margin-top: 28px;
  color: var(--muted);
}

/* Bottom */
.bottom {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: flex-end;
  animation: fadeUp 0.7s 0.4s ease both;
}
.stack-area {
  cursor: pointer;
  outline: none;
}
.stack-hint {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.45;
  max-height: 16px;
  transition: opacity 0.3s, letter-spacing 0.3s, max-height 0.3s;
}
.stack-area:hover .stack-hint,
.stack-area:focus-visible .stack-hint {
  opacity: 0;
  max-height: 0;
  letter-spacing: 0.18em;
}
.stack-list {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s ease;
}
.stack-area:hover .stack-list,
.stack-area:focus-visible .stack-list {
  max-height: 160px;
}
.stack-row {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.6;
  color: var(--fg);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.stack-area:hover .stack-row,
.stack-area:focus-visible .stack-row {
  opacity: 1;
  transform: translateY(0);
}
.stack-row:nth-child(1) { transition-delay: 0ms; }
.stack-row:nth-child(2) { transition-delay: 40ms; }
.stack-row:nth-child(3) { transition-delay: 80ms; }
.stack-row:nth-child(4) { transition-delay: 120ms; }
.stack-row:nth-child(5) { transition-delay: 160ms; }

.contact-group {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 6px;
}
.services-link {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.services-link:hover, .services-link:focus-visible { color: var(--fg); }
.contact {
  font-family: 'DM Mono', monospace;
  font-size: 12px; letter-spacing: 0.04em;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--fg);
  padding-bottom: 2px;
  transition: opacity 0.2s;
}
.contact:hover, .contact:focus-visible { opacity: 0.6; }

/* Services & terms page */
.doc-stage {
  width: 100%; min-height: 100vh;
  display: flex; justify-content: center;
  padding: 40px 16px;
}
.doc-card {
  width: min(760px, 92vw);
  margin: auto;
  padding: clamp(32px, 6vw, 56px);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.13), 0 1px 4px rgba(0, 0, 0, 0.07);
  background: var(--bg-card);
}
.doc-header { animation: fadeUp 0.7s 0.1s ease both; }
.doc-brand {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 28px;
  transition: color 0.2s;
}
.doc-brand:hover, .doc-brand:focus-visible { color: var(--fg); }
.doc-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: clamp(28px, 4.5vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 18px;
  max-width: 16ch;
}
.doc-sub {
  max-width: 46ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}
.doc-section {
  border-top: 1px solid var(--rule);
  padding: clamp(28px, 5vw, 44px) 0;
  animation: fadeUp 0.7s 0.2s ease both;
}
.doc-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}
.doc-row {
  display: grid;
  grid-template-columns: 28px 170px 1fr;
  gap: 6px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.doc-row:last-child { border-bottom: 0; padding-bottom: 0; }
.doc-row .i {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.04em;
  color: var(--accent);
}
.doc-row .k {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500; font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.doc-terms .k {
  font-family: 'DM Mono', monospace;
  font-weight: 400; font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg);
}
.doc-row .v {
  font-size: 14px; line-height: 1.6;
  color: var(--muted);
}
.doc-contact { display: flex; gap: 20px; align-items: flex-start; }
.doc-contact .bar { width: 3px; align-self: stretch; background: var(--accent); flex: none; }
.doc-contact p {
  max-width: 46ch;
  font-size: 15px; line-height: 1.6;
  color: var(--muted);
  margin-bottom: 14px;
}
.doc-mail {
  font-family: 'DM Mono', monospace;
  font-size: 14px; letter-spacing: 0.04em;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--fg);
  padding-bottom: 2px;
  transition: opacity 0.2s;
}
.doc-mail:hover, .doc-mail:focus-visible { opacity: 0.6; }
.doc-footer {
  border-top: 1px solid var(--rule);
  padding-top: 24px;
  margin-top: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.04em;
  color: var(--muted);
}

@media (max-width: 560px) {
  .doc-row { grid-template-columns: 22px 1fr; }
  .doc-row .v { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .page, .accent, .ghost, .top, .center, .bottom, .stack-hint, .stack-list, .stack-row, .contact,
  .doc-header, .doc-section {
    animation: none !important;
    transition: none !important;
  }
}
