/* ============================================================
   Portfolio — Gaëtan De Toffoli
   Vanilla CSS. All theme tokens live in :root.
   Theming via [data-theme] on <html>. Dark is the default.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Color — dark theme (default) */
  --bg: #0d1117;
  --bg-elev: #161b22;
  --bg-alt: #0a0e14;
  --text: #e6edf3;
  --text-muted: #9aa7b4;
  --border: #2a323d;
  --accent: #34d399;          /* swap to #3DDC84 for an Android-green accent */
  --accent-hover: #5ee0ae;
  --accent-contrast: #06251c; /* text/icon color on top of --accent */
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);

  /* Spacing scale */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  /* Typography */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-h1: clamp(2.4rem, 5vw, 3.6rem);
  --fs-h2: clamp(1.7rem, 3.2vw, 2.3rem);
  --fs-h3: 1.2rem;
  --fs-lead: clamp(1.05rem, 2vw, 1.25rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;

  /* Layout */
  --maxw: 1100px;
  --radius: 14px;
  --radius-sm: 8px;
  --nav-h: 64px;
  --transition: 200ms ease;
}

/* Light theme overrides */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #f6f8fa;
  --bg-alt: #eef1f5;
  --text: #1f2328;
  --text-muted: #59636e;
  --border: #d0d7de;
  --accent: #047857;          /* darker emerald: AA contrast on white */
  --accent-hover: #059669;
  --accent-contrast: #ffffff;
  --shadow: 0 12px 30px rgba(140, 149, 159, 0.25);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

img { max-width: 100%; display: block; height: auto; }

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

h1, h2, h3 { line-height: 1.2; margin: 0; }

ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

.section {
  padding-block: var(--space-6);
  scroll-margin-top: var(--nav-h);
}

.section--alt { background: var(--bg-alt); }

.section__head { max-width: 640px; margin-bottom: var(--space-4); }

.section__title { font-size: var(--fs-h2); letter-spacing: -0.02em; }

.section__subtitle {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: var(--fs-lead);
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--maxw);
  margin-inline: auto;
  min-height: var(--nav-h);
  padding-inline: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 600;
}

.nav__brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav__link {
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--transition);
}

.nav__link:hover,
.nav__link.is-active { color: var(--text); }

.nav__link.is-active { color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

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

/* Mobile menu toggle (hamburger) — hidden on desktop */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  cursor: pointer;
}

.nav__toggle-bar {
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--fs-body);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition),
              color var(--transition), transform var(--transition);
}

.btn:hover { transform: translateY(-1px); }

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

.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  padding-block: var(--space-6) var(--space-5);
  scroll-margin-top: var(--nav-h);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  align-items: center;
  gap: var(--space-5);
}

.hero__eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--accent);
  font-weight: 600;
  font-size: var(--fs-small);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero__title { font-size: var(--fs-h1); letter-spacing: -0.03em; }

.hero__lead {
  margin: var(--space-2) 0 var(--space-4);
  max-width: 52ch;
  color: var(--text-muted);
  font-size: var(--fs-lead);
}

.hero__cta { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.hero__media { display: flex; justify-content: center; }

.hero__avatar {
  width: min(280px, 70vw);
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Project cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition),
              box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.card__media { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.card__media--logo {
  object-fit: contain;
  padding: 2.5rem 3.5rem;
  background: #ffffff;
}

.card__media--logo-dark {
  object-fit: contain;
  padding: 2.5rem 3.5rem;
  background: #1e1e1e;
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
}

.card__title { font-size: var(--fs-h3); }

/* Kakeru banner: swap image on theme change */
.kakeru-banner--light { display: none; }
[data-theme="light"] .kakeru-banner--dark { display: none; }
[data-theme="light"] .kakeru-banner--light { display: block; }

.card__title-ja {
  font-size: 0.85em;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.35em;
}

.card__text { margin: 0; color: var(--text-muted); }

.card__links { display: flex; gap: var(--space-3); margin-top: auto; }

.card__note {
  margin: auto 0 0;
  color: var(--text-muted);
  font-size: var(--fs-small);
}

.link {
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

.link:hover { border-color: var(--accent); }

.link--soon {
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--fs-small);
  cursor: default;
  opacity: 0.6;
}

/* Tags / chips */
.tags, .chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }

.tag, .chip {
  font-size: var(--fs-small);
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.chip { color: var(--text); }

/* ---------- Stack ---------- */
.stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

.stack__group {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.stack__label {
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-4);
  align-items: center;
}

.about__img { border-radius: var(--radius); box-shadow: var(--shadow); }

.about__content p { margin: 0 0 var(--space-2); color: var(--text-muted); }
.about__content .section__title { margin-bottom: var(--space-2); color: var(--text); }

/* ---------- Contact ---------- */
.contact__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-3);
  color: var(--text-muted);
  font-size: var(--fs-small);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: space-between;
}

.site-footer p { margin: 0; }

/* ---------- Scroll reveal ----------
   Hidden initial state only applies when JS is on (.js on <html>),
   so the page is fully visible if JS is disabled. */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__lead { margin-inline: auto; }
  .hero__cta { justify-content: center; }
  .hero__media { order: -1; }
  .about { grid-template-columns: 1fr; text-align: center; }
  .about__media { justify-self: center; }
}

@media (max-width: 640px) {
  .nav__toggle { display: flex; }

  .nav__menu {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition);
  }

  .nav__menu.is-open {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .section { padding-block: var(--space-5); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .btn:hover, .card:hover { transform: none; }
}
