/* ===========================================================
   LEAK blog — base layer
   shadcn/ui design tokens applied to the layout metrics of the
   original portfolio blog (same spacing scale, same rem sizes).

   Tokens are HSL channel triplets, consumed as hsl(var(--token)).
   NOTE: html font-size is 62.5%, so 1rem = 10px here. The shadcn
   0.5rem radius is therefore written as 0.8rem (= 8px).
   =========================================================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: inherit;
}

/* ---------- Design tokens (light) ---------- */
:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 3.9%;

  --card: 0 0% 100%;
  --card-foreground: 0 0% 3.9%;

  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 3.9%;

  --primary: 0 0% 9%;
  --primary-foreground: 0 0% 98%;

  --secondary: 0 0% 96.1%;
  --secondary-foreground: 0 0% 9%;

  --muted: 0 0% 96.1%;
  --muted-foreground: 0 0% 45.1%;

  --accent: 0 0% 96.1%;
  --accent-foreground: 0 0% 9%;

  --border: 0 0% 89.8%;
  --input: 0 0% 89.8%;
  --ring: 0 0% 3.9%;

  --radius: 0.8rem;

  /* Code surfaces stay dark in both themes (as in the shadcn docs). */
  --code-bg: 240 6% 7%;
  --code-fg: 0 0% 96%;
  --code-border: 240 5% 18%;
}

/* ---------- Design tokens (dark) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;

    --card: 0 0% 3.9%;
    --card-foreground: 0 0% 98%;

    --popover: 0 0% 3.9%;
    --popover-foreground: 0 0% 98%;

    --primary: 0 0% 98%;
    --primary-foreground: 0 0% 9%;

    --secondary: 0 0% 14.9%;
    --secondary-foreground: 0 0% 98%;

    --muted: 0 0% 14.9%;
    --muted-foreground: 0 0% 63.9%;

    --accent: 0 0% 14.9%;
    --accent-foreground: 0 0% 98%;

    --border: 0 0% 14.9%;
    --input: 0 0% 14.9%;
    --ring: 0 0% 83.1%;
  }
}

[data-theme="dark"] {
  --background: 0 0% 3.9%;
  --foreground: 0 0% 98%;

  --card: 0 0% 3.9%;
  --card-foreground: 0 0% 98%;

  --popover: 0 0% 3.9%;
  --popover-foreground: 0 0% 98%;

  --primary: 0 0% 98%;
  --primary-foreground: 0 0% 9%;

  --secondary: 0 0% 14.9%;
  --secondary-foreground: 0 0% 98%;

  --muted: 0 0% 14.9%;
  --muted-foreground: 0 0% 63.9%;

  --accent: 0 0% 14.9%;
  --accent-foreground: 0 0% 98%;

  --border: 0 0% 14.9%;
  --input: 0 0% 14.9%;
  --ring: 0 0% 83.1%;
}

/* ---------- Root sizing (same scale as the portfolio) ---------- */
html {
  font-size: 62.5%;
  scroll-behavior: smooth;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
}

/* 75em === 1200px */
@media (max-width: 75em) {
  html {
    font-size: 60%;
  }
}

/* 56.25em === 900px */
@media (max-width: 56.25em) {
  html {
    font-size: 58%;
  }
}

/* 37.5em === 600px */
@media (max-width: 37.5em) {
  html {
    font-size: 56%;
  }
}

body {
  /* Geist / Geist Mono, the typefaces shadcn/ui itself ships with */
  font-family: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "rlig" 1, "calt" 1;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

ul {
  list-style: none;
}

a {
  text-decoration: none;
  color: inherit;
}

:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: calc(var(--radius) - 0.4rem);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: hsl(var(--muted-foreground) / 0.35);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: hsl(var(--muted-foreground) / 0.6);
}

* {
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--muted-foreground) / 0.35) transparent;
}

.main-container {
  max-width: 120rem;
  margin: auto;
  width: 90%;
}

/* ===========================================================
   Buttons (shadcn variants)
   =========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 1.1rem 1.8rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-outline {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.btn-outline:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-ghost {
  background: transparent;
  color: hsl(var(--foreground));
}

.btn-ghost:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-icon {
  padding: 0;
  width: 3.6rem;
  height: 3.6rem;
  flex: 0 0 auto;
}

.btn-icon svg {
  width: 1.7rem;
  height: 1.7rem;
  display: block;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid hsl(var(--border));
  border-radius: 100px;
  padding: 0.3rem 1.1rem;
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: hsl(var(--foreground));
  background: hsl(var(--secondary));
}

/* ===========================================================
   Header
   =========================================================== */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2.5rem;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: hsl(var(--background) / 0.85);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid hsl(var(--border));
  transition: transform 0.35s ease, border-color 0.35s ease;
}

.main-header--hidden {
  transform: translateY(-100%);
}

/* No divider while at the very top or hidden */
.main-header--top,
.main-header--hidden {
  border-bottom-color: transparent;
}

.main-header__logo-container {
  display: flex;
  align-items: center;
}

.main-header__logo {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

/* Wordmark — text only, links to the main site. Uppercased in CSS so the
   mark stays uppercase whatever is typed into logo_text. */
.main-header__logo-text {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: hsl(var(--foreground));
  transition: opacity 0.15s ease;
}

.main-header__logo:hover .main-header__logo-text {
  opacity: 0.7;
}

.main-header__navigation-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.main-header__navigation-link a {
  display: inline-block;
  padding: 0.9rem 1.4rem;
  font-size: 1.5rem;
  font-weight: 500;
  border-radius: var(--radius);
  color: hsl(var(--muted-foreground));
  transition: color 0.15s ease, background-color 0.15s ease;
}

.main-header__navigation-link a:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--accent));
}

.main-header__navigation-link--active a {
  color: hsl(var(--foreground));
}

@media (max-width: 37.5em) {
  .main-header {
    padding: 1.8rem 1.5rem;
  }

  .main-header__navigation-links {
    display: none;
  }
}

/* ---------- Header actions (language + theme + burger) ---------- */
.main-header__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ---------- Language menu (globe trigger + flag list) ---------- */
.lang-menu {
  position: relative;
}

.lang-menu__trigger[aria-expanded="true"] {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.lang-menu__panel {
  position: absolute;
  top: calc(100% + 0.8rem);
  right: 0;
  z-index: 1100;
  min-width: 19rem;
  padding: 0.5rem;
  display: grid;
  gap: 0.2rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  box-shadow: 0 10px 15px -3px hsl(0 0% 0% / 0.1), 0 4px 6px -4px hsl(0 0% 0% / 0.1);
  animation: lang-menu-in 0.12s ease-out;
}

.lang-menu__panel[hidden] {
  display: none;
}

@keyframes lang-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.lang-menu__item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: calc(var(--radius) - 0.3rem);
  font-size: 1.5rem;
  font-weight: 500;
  color: hsl(var(--popover-foreground));
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lang-menu__item:hover {
  background: hsl(var(--accent));
}

.lang-menu__item--active {
  cursor: default;
}

.lang-menu__name {
  flex: 1 1 auto;
}

.lang-menu__flag {
  display: inline-flex;
  flex: 0 0 auto;
  width: 2.2rem;
  height: 1.65rem;
  overflow: hidden;
  border-radius: 3px;
  border: 1px solid hsl(var(--border));
}

.lang-menu__flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

.lang-menu__check {
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  color: hsl(var(--muted-foreground));
}

/* Burger */
.main-header__sm-scr-nav-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.main-header__sm-scr-nav-btn:hover {
  background: hsl(var(--accent));
}

@media (max-width: 37.5em) {
  .main-header__sm-scr-nav-btn {
    display: flex;
  }
}

.main-header__sm-scr-nav-btn-line {
  height: 1.5px;
  width: 2rem;
  border-radius: 50px;
  background: hsl(var(--foreground));
}

/* ---------- Mobile menu ---------- */
.main-header__sm-menu {
  background: hsl(var(--background));
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 40rem;
  transform: translateX(-100%);
  transition: transform 0.5s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-header__sm-menu--active {
  transform: translateX(0);
}

.main-header__sm-menu-close {
  position: absolute;
  top: 3rem;
  right: 2.5rem;
  width: 3rem;
  height: 3rem;
  cursor: pointer;
}

.main-header__sm-menu-close:before,
.main-header__sm-menu-close:after {
  position: absolute;
  content: " ";
  height: 3rem;
  width: 1.5px;
  left: 50%;
  transform: translateX(-50%);
  background-color: hsl(var(--foreground));
}

.main-header__sm-menu-close:before {
  transform: rotate(45deg);
}

.main-header__sm-menu-close:after {
  transform: rotate(-45deg);
}

.main-header__sm-menu-links {
  width: 90%;
}

.main-header__sm-menu-link {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.3s, transform 0.3s;
  font-size: 2.4rem;
  font-weight: 500;
  text-align: center;
  display: block;
  padding: 2.6rem;
  -webkit-tap-highlight-color: transparent;
  color: hsl(var(--muted-foreground));
}

/* ===========================================================
   Footer
   =========================================================== */
.main-footer {
  margin-top: 2rem;
}

.main-footer__upper {
  background: hsl(var(--background));
  border-top: 1px solid hsl(var(--border));
  padding: 7rem 0 5.5rem 0;
}

/* Brand block wide, link columns narrow */
.main-footer__grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr;
  gap: 4rem 6rem;
}

/* ---------- Brand column ---------- */
.main-footer__brand {
  max-width: 38rem;
}

.main-footer__wordmark {
  display: inline-block;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: hsl(var(--foreground));
  transition: opacity 0.15s ease;
}

.main-footer__wordmark:hover {
  opacity: 0.7;
}

.main-footer__tagline {
  margin-top: 1.4rem;
  font-size: 1.45rem;
  line-height: 1.65;
  color: hsl(var(--muted-foreground));
}

.main-footer__socials {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2.4rem;
}

.main-footer__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  transition: color 0.15s ease, border-color 0.15s ease,
    background-color 0.15s ease;
}

.main-footer__social-link:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--foreground) / 0.3);
  background: hsl(var(--accent));
}

.main-footer__social-link svg {
  width: 1.7rem;
  height: 1.7rem;
  display: block;
}

/* ---------- Link columns ---------- */
.main-footer__col-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: hsl(var(--foreground));
  margin-bottom: 1.8rem;
}

.main-footer__links {
  display: grid;
  gap: 1.1rem;
}

.main-footer__link a {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 1.45rem;
  font-weight: 400;
  color: hsl(var(--muted-foreground));
  transition: color 0.15s ease;
}

.main-footer__link a:hover {
  color: hsl(var(--foreground));
}

.main-footer__link a[aria-current="true"] {
  color: hsl(var(--foreground));
  font-weight: 500;
}

.main-footer__flag {
  display: inline-flex;
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.4rem;
  overflow: hidden;
  border-radius: 2px;
  border: 1px solid hsl(var(--border));
}

.main-footer__flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Bottom bar ---------- */
.main-footer__bottom {
  padding: 2.4rem 0;
  background: hsl(var(--muted));
  border-top: 1px solid hsl(var(--border));
}

.main-footer__bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  flex-wrap: wrap;
}

.main-footer__bottom-txt {
  color: hsl(var(--muted-foreground));
  font-size: 1.3rem;
}

.main-footer__bottom-link {
  font-size: 1.3rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: color 0.15s ease;
}

.main-footer__bottom-link:hover {
  color: hsl(var(--foreground));
}

/* ---------- Responsive ---------- */
@media (max-width: 56.25em) {
  .main-footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 4.5rem 4rem;
  }

  .main-footer__brand {
    grid-column: 1 / -1;
    max-width: 46rem;
  }
}

@media (max-width: 37.5em) {
  .main-footer__upper {
    padding: 5.5rem 0 4.5rem 0;
  }

  .main-footer__grid {
    grid-template-columns: 1fr;
    gap: 4rem;
  }

  .main-footer__brand {
    grid-column: auto;
  }

  .main-footer__bottom-inner {
    justify-content: center;
    text-align: center;
  }
}

/* ===========================================================
   Theme toggle icon swapping
   Light theme shows the moon (click -> dark); dark shows the sun.
   =========================================================== */
.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* ===========================================================
   Language gateway (root index.html)
   =========================================================== */
.gateway {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
}

.gateway__card {
  width: 100%;
  max-width: 46rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 0.4rem);
  background: hsl(var(--card));
  padding: 4rem;
  text-align: center;
}

.gateway__mark {
  display: inline-block;
  margin: 0 auto 2.4rem auto;
  color: hsl(var(--foreground));
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: opacity 0.15s ease;
}

.gateway__mark:hover {
  opacity: 0.7;
}

.gateway__title {
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.gateway__subtitle {
  margin-top: 1rem;
  font-size: 1.6rem;
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
}

.gateway__options {
  margin-top: 3rem;
  display: grid;
  gap: 1.2rem;
}

.gateway__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  padding: 1.6rem 2rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-size: 1.6rem;
  font-weight: 500;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.gateway__option:hover {
  background: hsl(var(--accent));
}

.gateway__option-code {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
