/* --- Theme: cream & orange, InternalOS-inspired (no pixel art) --- */
:root {
  --cream: #faf8f0;
  --cream-dark: #ede9dc;
  --orange: #c45c2a;
  --orange-light: #e07a4a;
  --orange-dark: #9e4520;
  --text: #2c2520;
  --text-muted: #5c534c;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text);
  background: var(--cream);
  overflow-x: hidden;
}

/* --- Cases two-column layout with tree --- */
.cases-layout {
  display: flex;
  align-items: flex-start;
  width: 100%;
}

.cases-content {
  flex: 0 0 62%;
  min-width: 0;
}

.cases-tree {
  flex: 0 0 38%;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}

#tree-canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#tree-canvas.ready {
  opacity: 1;
}

@media (max-width: 768px) {
  .cases-layout {
    display: block;
  }

  .cases-content {
    width: 100%;
  }

  .cases-tree {
    display: none;
  }
}

/* --- Nav --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  background: rgba(246, 242, 235, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, padding 0.3s ease;
}

.nav.scrolled {
  border-bottom-color: var(--cream-dark);
}

.nav-logo {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: color 0.2s ease;
}

.nav-links a {
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--orange);
  transition: width 0.25s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--orange);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width:  min(85%, 320px);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    background: var(--cream);
    border-left: 1px solid var(--cream-dark);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 24px rgba(0,0,0,0.06);
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-toggle {
    display: flex;
  }
}

/* --- Areas (sections) --- */
.area {
  min-height: 55vh;
  display: flex;
  align-items: center;
  padding: 2rem 1.25rem 1.5rem;
  position: relative;
}

.area-inner {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.area-heading {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
  margin: 0 0 0.35rem;
  color: var(--text);
}

.area-lead {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  max-width: 540px;
}

/* --- Home --- */
.area-home {
  padding-top: 3.5rem;
  text-align: center;
  background: linear-gradient(180deg, var(--cream) 0%, rgba(246, 242, 235, 0.6) 100%);
}

.home-tagline {
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--orange);
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.home-title {
  font-family: var(--serif);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--text);
  transform: translateY(24px) scale(0.98);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.home-title em {
  font-style: italic;
  color: var(--orange);
}

.home-sub {
  font-size: 1.1875rem;
  font-weight: 600;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 0.75rem;
}

.home-cta {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 4.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.65rem 1.35rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  cursor: pointer;
  border: none;
}

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

.btn-primary:hover {
  background: var(--orange-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(196, 92, 42, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--cream-dark);
}

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

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.scroll-hint-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
  border-radius: 2px;
  animation: scrollHint 2s ease-in-out infinite;
}

@keyframes scrollHint {
  0%, 100% { opacity: 0.4; transform: scaleY(0.6); transform-origin: top; }
  50% { opacity: 1; transform: scaleY(1); transform-origin: top; }
}

/* --- Who am I --- */
.area-who {
  background: var(--cream-dark);
}

.who-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.who-lead {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.who-intro p {
  margin: 0 0 0.35rem;
  font-weight: 500;
  color: var(--text-muted);
}

.who-intro p:last-child {
  margin-bottom: 0;
}

.who-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--cream);
  color: var(--text);
  border-radius: 100px;
  border: 1px solid rgba(44, 37, 32, 0.12);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.badge:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.who-extra {
  padding-top: 0.5rem;
  border-top: 1px solid rgba(44, 37, 32, 0.1);
}

.who-extra p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.who-extra a {
  color: var(--orange);
  text-decoration: none;
  font-weight: 500;
}

.who-extra a:hover {
  text-decoration: underline;
}

/* --- Cases --- */
.area-cases {
  background: #fffcf3;
}

.cases-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.case-card {
  background: var(--cream-dark);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.case-card:hover {
  border-color: rgba(196, 92, 42, 0.25);
  transform: translateX(6px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.06);
}

.case-number {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--orange);
  margin-bottom: 0.35rem;
  opacity: 0.9;
}

.case-card h3 {
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 400;
  margin: 0 0 0.35rem;
}

.case-card p {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.collapsible {
  margin-top: 0.15rem;
}

.collapsible-extra {
  display: none;
  margin-top: 0.35rem;
}

.collapsible-extra.is-open {
  display: block;
}

.collapsible-toggle {
  margin-top: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--orange);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.collapsible-toggle:hover {
  text-decoration: underline;
}

.case-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--orange);
  text-decoration: none;
}

.case-link:hover {
  text-decoration: underline;
}

/* --- Services --- */
.area-services {
  background: var(--cream-dark);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  align-items: stretch;
}

.service-card {
  background: var(--cream);
  padding: 1rem 1rem 4.25rem;
  border-radius: 12px;
  border: 1px solid rgba(44, 37, 32, 0.08);
  position: relative;
  min-height: 380px;
  height: 100%;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
  border-color: rgba(196, 92, 42, 0.2);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.06);
}

.service-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--orange);
  background: rgba(196, 92, 42, 0.1);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.service-card h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  margin: 0 0 0.35rem;
}

.service-card p {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.55;
}

.service-text-long {
  margin-bottom: 1.25rem;
}

.service-price {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  padding: 0.45rem 0.75rem;
  display: block;
  text-align: center;
  background: var(--orange-light);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.service-price:hover {
  background: var(--orange-dark);
  color: #fff;
}

/* --- Contact --- */
.contact-lead {
  margin-bottom: 0.75rem;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.contact-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
  opacity: 0.8;
}

/* --- Footer --- */
.footer {
  padding: 0.75rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--cream-dark);
}

/* --- Animations (entrance) --- */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

.home-title.visible {
  transform: translateY(0) scale(1);
}

[data-animate].stagger-1 { transition-delay: 0.05s; }
[data-animate].stagger-2 { transition-delay: 0.1s; }
[data-animate].stagger-3 { transition-delay: 0.15s; }
[data-animate].stagger-4 { transition-delay: 0.2s; }
[data-animate].stagger-5 { transition-delay: 0.25s; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  [data-animate] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .scroll-hint-line {
    animation: none;
  }

  .case-card:hover,
  .service-card:hover,
  .btn-primary:hover {
    transform: none;
  }
}
