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

/* Local Fonts: Figtree + Anonymous Pro */
@font-face {
  font-family: 'Figtree';
  src: local('Figtree'), url('../fonts/Figtree-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Figtree';
  src: local('Figtree'), url('../fonts/Figtree-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Figtree';
  src: local('Figtree'), url('../fonts/Figtree-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Figtree';
  src: local('Figtree'), url('../fonts/Figtree-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Figtree';
  src: local('Figtree'), url('../fonts/Figtree-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Figtree';
  src: local('Figtree'), url('../fonts/Figtree-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Anonymous Pro';
  src: local('Anonymous Pro'), url('../fonts/AnonymousPro-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Anonymous Pro';
  src: local('Anonymous Pro'), url('../fonts/AnonymousPro-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* OpenLat Ayu Auto Theme (Light & Dark)
 * Palette: Ayu Theme (https://ayutheme.com & ayu-colors).
 * Light mode (Ayu Light): #fcfcfc / #f8f9fa / accent #d47800 (#fa8532)
 * Dark mode (Ayu Dark): #0d1017 / #10141c / golden accent #e6b450
 */
:root {
  color-scheme: light dark;
  --bg-primary: #fcfcfc;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f0f2f5;
  --bg-quaternary: #e9ecf0;
  --border-clr: #d8dde3;
  --accent-clr: #d47800;
  --accent-hover: #b86500;
  --btn-text: #ffffff;
  --text-primary: #3d4247;
  --text-muted: #656c73;
  --kbd-bg: #f8f9fa;
  --kbd-grad-1: #ffffff;
  --kbd-grad-2: #f0f2f5;
  --kbd-border: #d8dde3;
  --step-bg: rgba(0, 0, 0, 0.03);
  --step-shadow: rgba(60, 70, 80, 0.12);
  --nav-height: 48px;
  --font-sans: 'Figtree', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Anonymous Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-primary: #0d1017;
    --bg-secondary: #10141c;
    --bg-tertiary: #161b24;
    --bg-quaternary: #090c10;
    --border-clr: #252b36;
    --accent-clr: #e6b450;
    --accent-hover: #ffc766;
    --btn-text: #0d1017;
    --text-primary: #bfbdb6;
    --text-muted: #8c96a0;
    --kbd-bg: #0d1017;
    --kbd-grad-1: #161b24;
    --kbd-grad-2: #10141c;
    --kbd-border: #252b36;
    --step-bg: rgba(0, 0, 0, 0.35);
    --step-shadow: rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #0d1017;
  --bg-secondary: #10141c;
  --bg-tertiary: #161b24;
  --bg-quaternary: #090c10;
  --border-clr: #252b36;
  --accent-clr: #e6b450;
  --accent-hover: #ffc766;
  --btn-text: #0d1017;
  --text-primary: #bfbdb6;
  --text-muted: #8c96a0;
  --kbd-bg: #0d1017;
  --kbd-grad-1: #161b24;
  --kbd-grad-2: #10141c;
  --kbd-border: #252b36;
  --step-bg: rgba(0, 0, 0, 0.35);
  --step-shadow: rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #fcfcfc;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f0f2f5;
  --bg-quaternary: #e9ecf0;
  --border-clr: #d8dde3;
  --accent-clr: #d47800;
  --accent-hover: #b86500;
  --btn-text: #ffffff;
  --text-primary: #3d4247;
  --text-muted: #656c73;
  --kbd-bg: #f8f9fa;
  --kbd-grad-1: #ffffff;
  --kbd-grad-2: #f0f2f5;
  --kbd-border: #d8dde3;
  --step-bg: rgba(0, 0, 0, 0.03);
  --step-shadow: rgba(60, 70, 80, 0.12);
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  margin: 0;
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

p {
  margin: 0;
  line-height: 1.4;
}

a {
  color: var(--accent-clr);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

button {
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
  background: none;
  border: none;
  margin: 0;
  padding: 0;
  display: block;
}

code {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-clr);
  border-radius: 3px;
  tab-size: 4ch;
  word-break: break-word;
  padding: 0.1rem 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.9em;
  display: inline-block;
  color: var(--text-primary);
}

kbd {
  padding-inline: 0.25rem;
  vertical-align: baseline;
  background-color: var(--kbd-bg);
  background-image: linear-gradient(var(--kbd-grad-1) 0%, var(--kbd-grad-2) 10% 70%, var(--kbd-grad-1));
  border: 1px solid var(--kbd-border);
  border-radius: 0.25rem;
  padding-bottom: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: inline-block;
  color: var(--text-primary);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

pre {
  margin: 0;
}

pre code {
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  margin: 0.1rem 0;
  padding: 0.2rem 0.4rem;
  line-height: 1.3;
  display: block;
}

.max-width {
  width: 100%;
  max-width: 70rem;
  margin: 0 auto;
}

h1, h2, h3 {
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1:first-child,
h2:first-child,
h3:first-child {
  margin-top: 0;
}

.layout-wrapper {
  grid-template-rows: min-content 1fr min-content;
  min-height: 100svh;
  display: grid;
}

/* Navigation */
nav {
  height: var(--nav-height);
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  display: flex;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-clr);
}

.nav-logo {
  user-select: none;
  color: var(--text-primary);
  align-items: center;
  gap: 0.6rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
}

.nav-logo:hover {
  text-decoration: none;
}

.nav-logo img {
  width: 2rem;
  height: 2rem;
  display: block;
}

.nav-logo-text {
  letter-spacing: -0.02em;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-picker {
  display: flex;
  align-items: center;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-clr);
  border-radius: 0.35rem;
  padding: 2px;
  gap: 2px;
}

.lang-btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.25rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
  line-height: 1;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background-color: var(--accent-clr);
  color: var(--btn-text);
}

.theme-toggle-btn {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 0.35rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-clr);
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-clr);
}

.theme-toggle-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.nav-link {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  display: inline-flex;
  align-items: center;
}

.nav-link:hover {
  color: var(--accent-clr);
  text-decoration: none;
}

a.primary {
  color: var(--btn-text);
  background-color: var(--accent-clr);
  user-select: none;
  border-radius: 0.25rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.15s ease;
}

a.primary:hover {
  text-decoration: none;
  opacity: 0.9;
}

/* Page & Main */
.page {
  display: contents;
}

main {
  background-color: var(--bg-primary);
  min-height: 100%;
  overflow: hidden;
}

.hero {
  background-color: var(--bg-secondary);
  place-items: center;
  min-height: 20rem;
  font-size: 1.5rem;
  display: grid;
  border-bottom: 1px solid var(--border-clr);
}

.hero-content {
  width: 100%;
  padding: 2.5rem 1rem;
}

.hero-content h1 {
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
}

.hero-content p {
  font-size: 1.25rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 50rem;
}

.hero-content p a {
  font-weight: 600;
}

.section {
  width: 100%;
  padding: 2rem 1rem;
}

.section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.section > p {
  margin: 1rem 0;
  line-height: 1.5;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.section > p strong {
  color: var(--text-primary);
}

/* 3D Interactive Steps */
.row {
  gap: 1.25rem;
  display: flex;
}

.step-container {
  background-color: var(--step-bg);
  flex-grow: 1;
  flex-basis: 0;
  transition: box-shadow 0.1s ease;
  perspective: 1000px;
}

.step {
  border: 1px solid var(--border-clr);
  background-color: var(--bg-primary);
  flex-direction: column;
  justify-content: flex-start;
  gap: 1rem;
  height: 100%;
  padding: 1.5rem;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
  display: flex;
  transform: rotate3d(0, 0, 0, 0);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.15);
}

.step h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.step p {
  color: var(--text-muted);
  line-height: 1.45;
  font-size: 0.98rem;
}

@media screen and (min-width: 801px) {
  .step-container:hover {
    z-index: 2;
    box-shadow: 0 0 1.25rem 0.35rem var(--step-shadow);
  }

  .step-container:hover .step {
    transform: perspective(500px) rotateY(var(--angle-x, 0deg)) rotateX(var(--angle-y, 0deg)) scale(1.04);
    transition: none;
  }
}

@media screen and (max-width: 800px) {
  .row {
    flex-direction: column;
    gap: 1rem;
  }

  .hero-content h1 {
    font-size: 1.85rem;
  }

  .hero-content p {
    font-size: 1.1rem;
  }
}

/* Footer */
footer {
  background-color: var(--bg-quaternary);
  border-top: 1px solid var(--border-clr);
  line-height: unset;
  display: grid;
}

.footer-main {
  gap: 2.5rem;
  width: 100%;
  max-width: 110rem;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  align-items: flex-start;
}

.footer-section.logo {
  user-select: none;
  place-items: center;
  width: 6rem;
  display: grid;
}

.footer-section.logo img {
  width: 100%;
  height: unset;
  aspect-ratio: 1;
}

@media (max-width: 880px) {
  .footer-main {
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    padding: 1.5rem 1rem;
  }

  .footer-section.logo {
    width: 3.5rem;
  }
}

.footer-section .heading {
  margin-bottom: 0.5rem;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.footer-section > a,
.footer-section > p {
  width: fit-content;
  margin: 0;
  padding: 0.25rem 0;
  display: block;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.footer-section > a {
  color: var(--accent-clr);
}
