/* ===========================
   CSS Custom Properties
   =========================== */

/* Dark mode (default) */
:root {
  --bg-page: #002b36;
  --bg-card: #073642;
  --text-body: #839496;

  /* Accent colors (same in both modes) */
  --accent-blue: #268bd2;
  --accent-cyan: #2aa198;
  --accent-green: #859900;

  /* Typography */
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Light mode via OS preference */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-page: #fdf6e3;
    --bg-card: #eee8d5;
    --text-body: #657b83;
  }
}

/* Explicit theme overrides */
[data-theme="light"] {
  --bg-page: #fdf6e3;
  --bg-card: #eee8d5;
  --text-body: #657b83;
}

[data-theme="dark"] {
  --bg-page: #002b36;
  --bg-card: #073642;
  --text-body: #839496;
}

/* ===========================
   Reset / Normalize
   =========================== */

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

/* ===========================
   Base Styles
   =========================== */

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a.card:hover {
  text-decoration: none;
}

/* ===========================
   Theme Toggle
   =========================== */

#theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-body);
  cursor: pointer;
  padding: 0.5rem;
  z-index: 100;
}

#theme-toggle:hover {
  color: var(--accent-cyan);
}

/* Sun shown in dark mode, moon shown in light mode */
.icon-moon { display: none; }
.icon-sun { display: block; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-sun { display: none; }
  :root:not([data-theme="dark"]) .icon-moon { display: block; }
}

[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ===========================
   Hero Section
   =========================== */

.hero {
  display: flex;
  justify-content: center;
  padding: 8rem 2rem 2rem;
}

.hero-lockup {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2rem;
  border: 1px solid rgba(131, 148, 150, 0.3);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  background: #fdf6e3;
  color: #657b83;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .hero-lockup {
    background: #002b36;
    color: #839496;
  }
}

[data-theme="light"] .hero-lockup {
  border-color: rgba(101, 123, 131, 0.3);
  background: #002b36;
  color: #839496;
}

.hero-text {
  display: flex;
  flex-direction: column;
}

.company-name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 3rem;
  margin-bottom: 0;
  line-height: 1;
}

.motto {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  text-transform: lowercase;
  margin-top: 2px;
}

.motto-up { color: var(--accent-green); }
.motto-down { color: var(--accent-blue); }
.motto-across { color: var(--accent-cyan); }

/* ===========================
   Stack Logo Animation
   =========================== */

.stack-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stack-rect {
  width: 60px;
  height: 20px;
  opacity: 0;
  animation-fill-mode: forwards;
  animation-timing-function: ease-out;
}

.rect-top {
  background-color: var(--accent-blue);
  animation: fly-down 0.4s ease-out 0.5s forwards;
}

.rect-middle {
  background-color: var(--accent-cyan);
  animation: slide-right 0.4s ease-out 1.0s forwards;
}

.rect-bottom {
  background-color: var(--accent-green);
  animation: fly-up 0.4s ease-out 0s forwards;
}

@keyframes fly-up {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fly-down {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-right {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===========================
   Intro Text
   =========================== */

.intro-text {
  text-align: center;
  max-width: 600px;
  margin: 3rem auto 0;
  padding: 0 2rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-body);
}

.intro-text a {
  color: var(--text-body);
  text-decoration: underline;
}

/* ===========================
   Projects Section
   =========================== */

.projects {
  padding: 4rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  display: block;
  background-color: var(--bg-card);
  border-radius: 8px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-body);
}

.card-name {
  font-weight: 700;
  font-size: 1.2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.card-description {
  font-size: 0.95rem;
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 600px) {
  .hero-lockup {
    gap: 1.25rem;
  }

  .company-name {
    font-size: 1.75rem;
  }

  .motto {
    font-size: 0.8rem;
  }

  .stack-rect {
    width: 36px;
    height: 12px;
  }

  .projects {
    padding: 3rem 1rem;
  }
}
