/* HENEX Global CSS v1.6
   Scope: design tokens, light/dark theme, base reset, global navigation, buttons, footer, Back to Top and responsive menu. */

:root {
  --font-heading: "IBM Plex Sans", sans-serif;
  --font-body: "Inter", sans-serif;

  --color-brand-primary: #111827;
  --color-brand-secondary: #374151;
  --color-human: #3C8CF4;
  --color-emotion: #FF5688;
  --color-nature: #31BB8E;
  --color-essay: #6B7280;

  --color-human-tint: #EAF3FF;
  --color-emotion-tint: #FFEAF1;
  --color-nature-tint: #EAF8F3;

  --theme-bg: #F6F7F8;
  --theme-surface: #FFFFFF;
  --theme-surface-soft: #F0F3F5;
  --theme-border: #DDE3E7;
  --theme-border-soft: #EEF2F4;
  --theme-text: #202124;
  --theme-text-soft: #4E5661;
  --theme-muted: #737B86;
  --theme-card: #FFFFFF;
  --theme-card-soft: #F8FAFC;

  --theme-shadow-card: 0 16px 48px rgba(17, 24, 39, 0.08);
  --theme-shadow-card-hover: 0 22px 60px rgba(17, 24, 39, 0.13);

  --hero-text: #111827;
  --hero-text-soft: rgba(17, 24, 39, 0.72);
  --hero-kicker: rgba(17, 24, 39, 0.62);
  --hero-button-bg: #FFFFFF;
  --hero-button-text: #111827;
  --hero-button-border: rgba(17, 24, 39, 0.28);
  --footer-bg: #151719;

  --page-accent: var(--color-brand-primary);
  --page-accent-border: rgba(17, 24, 39, 0.18);
  --page-nav-card-bg: var(--theme-card);
  --page-nav-card-border: var(--theme-border-soft);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 30px;
  --radius-xl: 42px;

  --container: 1320px;
  --gutter: 40px;
  --section-pad: 96px;
}

[data-theme="dark"] {
  --theme-bg: #070809;
  --theme-surface: #0B0C0D;
  --theme-surface-soft: #121314;
  --theme-border: rgba(255, 255, 255, 0.13);
  --theme-border-soft: rgba(255, 255, 255, 0.09);
  --theme-text: #FFFFFF;
  --theme-text-soft: rgba(255, 255, 255, 0.74);
  --theme-muted: rgba(255, 255, 255, 0.58);
  --theme-card: #0D0E10;
  --theme-card-soft: #141516;

  --theme-shadow-card: 0 18px 54px rgba(0, 0, 0, 0.36);
  --theme-shadow-card-hover: 0 24px 70px rgba(0, 0, 0, 0.48);

  --hero-text: #FFFFFF;
  --hero-text-soft: rgba(255, 255, 255, 0.76);
  --hero-kicker: rgba(255, 255, 255, 0.72);
  --hero-button-bg: #FFFFFF;
  --hero-button-text: #111827;
  --hero-button-border: rgba(255, 255, 255, 0.38);
  --footer-bg: #181A1D;

  --page-nav-card-bg: var(--theme-card);
  --page-nav-card-border: var(--theme-border);
}

.page-works {
  --page-accent: var(--color-nature);
  --page-accent-border: rgba(49, 187, 142, 0.28);
  --page-nav-card-bg: #FFFFFF;
  --page-nav-card-border: rgba(49, 187, 142, 0.26);
}

[data-theme="dark"] .page-works {
  --page-accent-border: rgba(49, 187, 142, 0.30);
  --page-nav-card-bg: #0A100E;
  --page-nav-card-border: rgba(49, 187, 142, 0.30);
}

.page-lab {
  --page-accent: var(--color-emotion);
  --page-accent-border: rgba(255, 86, 136, 0.28);
  --page-nav-card-bg: #FFFFFF;
  --page-nav-card-border: rgba(255, 86, 136, 0.24);
}
[data-theme="dark"] .page-lab {
  --page-accent-border: rgba(255, 86, 136, 0.34);
  --page-nav-card-bg: #120A0E;
  --page-nav-card-border: rgba(255, 86, 136, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--theme-bg);
  color: var(--theme-text);
  font-family: var(--font-body);
  line-height: 1.58;
  transition: background-color 180ms ease, color 180ms ease;
}

body.nav-open {
  overflow: hidden;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(60, 140, 244, 0.72);
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--theme-surface);
  color: var(--theme-text);
  font-weight: 800;
  transform: translateY(-140%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.container {
  width: min(var(--container), calc(100% - var(--gutter)));
  margin-inline: auto;
}

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

.section-kicker {
  margin: 0 0 14px;
  color: var(--theme-muted);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-heading);
  letter-spacing: -0.026em;
}

h1 {
  font-size: clamp(3rem, 6vw, 5.75rem);
  line-height: 1.02;
  font-weight: 750;
}

h2 {
  font-size: clamp(2.25rem, 4.6vw, 4.3rem);
  line-height: 1.03;
  font-weight: 700;
}

h3 {
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.14;
  font-weight: 700;
}

p {
  margin: 0;
}

.lead,
.home-hero__lead {
  color: var(--theme-text-soft);
  font-size: clamp(1.1rem, 1.7vw, 1.45rem);
  line-height: 1.45;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--theme-bg) 88%, transparent);
  border-bottom: 1px solid var(--theme-border);
  backdrop-filter: blur(20px);
}

.site-header__inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.site-brand {
  position: relative;
  z-index: 70;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.36em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--theme-text-soft);
  font-size: 0.875rem;
  font-weight: 650;
}

.site-nav a {
  position: relative;
  padding: 8px 0;
}

.site-nav a:not(.site-nav__cta)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 2px;
  border-radius: 999px;
  background: var(--theme-text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.site-nav a:not(.site-nav__cta):hover::after,
.site-nav a:not(.site-nav__cta):focus-visible::after {
  transform: scaleX(1);
}

.site-nav__cta {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px !important;
  border: 1px solid var(--theme-text);
  border-radius: var(--radius-sm);
  background: var(--theme-text);
  color: var(--theme-bg);
  font-weight: 800;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.site-nav__cta::after {
  display: none;
}

.site-nav__cta:hover,
.site-nav__cta:focus-visible {
  transform: translateY(-1px);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  gap: 0;
  border: 1px solid var(--theme-border);
  border-radius: 999px;
  background: var(--theme-surface);
  color: var(--theme-text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  appearance: none;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--theme-text) 28%, var(--theme-border));
}

.theme-icon {
  width: 20px;
  height: 20px;
  display: none;
  pointer-events: none;
}
[data-theme="light"] .theme-icon--sun,
[data-theme="dark"] .theme-icon--moon {
  display: block;
}
[data-theme="dark"] .theme-icon,
[data-theme="dark"] .back-to-top img {
  filter: invert(1);
}
[data-theme="light"] .theme-icon,
[data-theme="light"] .back-to-top img {
  filter: none;
}
.theme-toggle__dot,
.theme-toggle [data-theme-label] {
  display: none;
}

.nav-toggle {
  display: none;
  position: relative;
  z-index: 120;
  width: 48px;
  height: 44px;
  border: 1px solid var(--theme-border);
  border-radius: 999px;
  background: var(--theme-surface);
  color: var(--theme-text);
  cursor: pointer;
}

.nav-toggle__line {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 180ms ease, top 180ms ease;
}

.nav-toggle__line:first-child {
  top: 16px;
}

.nav-toggle__line:nth-child(2) {
  top: 24px;
}

.nav-toggle__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

body.nav-open .nav-toggle__line:first-child {
  top: 21px;
  transform: rotate(45deg);
}

body.nav-open .nav-toggle__line:nth-child(2) {
  top: 21px;
  transform: rotate(-45deg);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid var(--theme-text);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 800;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button--primary {
  background: var(--theme-text);
  color: var(--theme-bg);
}

.button--soft {
  background: var(--theme-surface-soft);
  color: var(--theme-text);
  border-color: var(--theme-border);
}

.button--hero-primary {
  background: var(--hero-button-bg);
  color: var(--hero-button-text);
  border-color: var(--hero-button-bg);
}

.button--hero-outline {
  color: var(--hero-text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--hero-button-border);
}

.button--footer {
  background: #FFFFFF;
  color: #151719;
  border-color: #FFFFFF;
}

.site-footer {
  padding: 76px 0 34px;
  background: var(--footer-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.35fr 0.45fr;
  gap: 60px;
  align-items: start;
}

.footer-intro p {
  max-width: 640px;
  margin: 18px 0 28px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1.15rem;
}

.footer-column {
  display: grid;
  gap: 18px;
}

.footer-column h3 {
  color: #FFFFFF;
  font-size: 1.4rem;
}

.footer-column a {
  color: #CBD5E1;
  font-size: 1.05rem;
}

.footer-column a:hover {
  color: #FFFFFF;
}

.footer-bottom {
  margin-top: 72px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.72);
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--theme-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-surface) 94%, transparent);
  color: var(--theme-text);
  box-shadow: var(--theme-shadow-card);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease, border-color 180ms ease;
}
.back-to-top img {
  width: 20px;
  height: 20px;
  pointer-events: none;
}
.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover,
.back-to-top:focus-visible {
  border-color: color-mix(in srgb, var(--theme-text) 28%, var(--theme-border));
  transform: translateY(-2px);
}
.page-hero {
  width: 100%;
  margin-inline: 0 !important;
}
.page-hero > .container,
.page-hero .page-hero__content {
  width: min(var(--container), calc(100% - var(--gutter)));
  margin-inline: auto;
}
@media (max-width: 900px) {
  :root {
    --gutter: 32px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  body.nav-open .site-header {
    position: fixed;
    inset: 0;
    height: 100dvh;
    z-index: 100;
    overflow-y: auto;
    background: var(--theme-bg);
  }

  body.nav-open .site-header__inner {
    min-height: 100dvh;
    align-items: flex-start;
    padding-top: 20px;
  }

  body.nav-open .site-brand,
  body.nav-open .nav-toggle {
    position: fixed;
    top: 20px;
    z-index: 120;
  }

  body.nav-open .site-brand {
    left: var(--gutter);
  }

  body.nav-open .nav-toggle {
    right: var(--gutter);
  }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 110;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 18px;
    padding: 112px var(--gutter) 56px;
    background: var(--theme-bg);
    color: var(--theme-text);
    font-family: var(--font-heading);
    font-size: clamp(2rem, 7vw, 4rem);
    font-weight: 650;
    letter-spacing: -0.03em;
    transform: translateX(100%);
    transition: transform 240ms ease;
  }

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

  .site-nav a {
    width: fit-content;
    max-width: 100%;
  }

  .site-nav__cta {
    min-height: 52px;
    margin-top: 10px;
    padding: 0 24px !important;
    border-radius: 18px;
    font-size: 1.25rem;
    letter-spacing: 0;
  }

  .site-nav .theme-toggle,
  .theme-toggle {
    width: 52px;
    height: 52px;
    max-width: 52px;
    min-width: 52px;
    min-height: 52px;
    padding: 0;
    margin-top: 10px;
    flex: 0 0 auto;
  }
  .theme-icon {
    width: 25px;
    height: 25px;
  }
  .back-to-top {
    right: 18px;
    bottom: 18px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  :root {
    --gutter: 24px;
    --section-pad: 56px;
  }

  body.nav-open .site-brand {
    left: 24px;
  }

  body.nav-open .nav-toggle {
    right: 24px;
  }

  .site-nav {
    padding-left: 24px;
    padding-right: 24px;
  }

  .footer-grid {
    gap: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* HENEX global hero CTA correction v5
   Scope: primary and secondary hero CTA buttons across Home, About, Philosophy and Works.
   Purpose: improve secondary CTA visibility on pale hero backgrounds while keeping dark mode consistent.
*/
.button--hero-primary {
  background: #151719;
  color: #ffffff;
  border-color: #151719;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.10);
}

.button--hero-outline {
  background: rgba(255, 255, 255, 0.72);
  color: #151719;
  border-color: rgba(17, 24, 39, 0.14);
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.07);
}

.button--hero-primary:hover,
.button--hero-primary:focus-visible,
.button--hero-outline:hover,
.button--hero-outline:focus-visible {
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.13);
}

[data-theme="dark"] .button--hero-primary {
  background: #ffffff;
  color: #070809;
  border-color: #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .button--hero-outline {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

[data-theme="dark"] .button--hero-outline:hover,
[data-theme="dark"] .button--hero-outline:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.34);
}
