/* ═══════════════════════════════════════════════════════════════
   ANTHROPIC DESIGN SYSTEM - Hugo Clarity Theme Customization
   ═══════════════════════════════════════════════════════════════ */

/* ===== GOOGLE FONTS IMPORT ===== */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400&family=JetBrains+Mono:wght@400;600&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  /* Typography - Anthropic-inspired */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Crimson Pro', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font: var(--font-sans);

  /* Anthropic Ivory Palette - Light Mode Backgrounds */
  --ivory-light: #faf9f5;
  --ivory-medium: #f0eee6;
  --ivory-dark: #e8e6dc;

  /* Anthropic Slate Palette - Light Mode Text */
  --slate-dark: #141413;
  --slate-medium: #3d3d3a;
  --slate-light: #5e5d59;

  /* Anthropic Cloud Palette - Subtle Text */
  --cloud-medium: #b0aea5;
  --cloud-light: #d1cfc5;

  /* Anthropic Accent - Clay */
  --clay: #d97757;
  --clay-dark: #b85d3f;

  /* ===== CLARITY THEME VARIABLES OVERRIDE (LIGHT MODE) ===== */
  --bg: #ffffff;
  --light: #faf9f5;
  --haze: #f0eee6;
  --xhaze: #e8e6dc;
  --gray: #141413;
  --text: #141413;
  --text-hover: #d97757;
  --header-text: #141413;
  --theme: #d97757;
  --accent: #d97757;
  --code-bg: #f0eee6;
  --table-bg: #ffffff;
  --table-haze: #f0eee6;
  --table-border: #e8e6dc;
  --footer-bg: #f0eee6;
  --post-bg: #ffffff;
  --choice-bg: #f0eee6;
  --shadow: rgba(20, 20, 19, 0.08);
  --translucent: rgba(20, 20, 19, 0.04);
  --translucent-light: rgba(255, 255, 255, 0.6);
}

/* ===== DARK MODE ===== */
html[data-mode="dim"],
html.page[data-mode="dim"] {
  /* Anthropic Dark Mode Backgrounds */
  --bg: #1f1e1d;
  --light: #faf9f5;
  --haze: #242220;
  --xhaze: #2a2826;

  /* Anthropic Dark Mode Text */
  --gray: #faf9f5;
  --text: #faf9f5;
  --text-hover: #d97757;
  --header-text: #faf9f5;
  --theme: #d97757;
  --accent: #d97757;

  /* Dark Mode Colors */
  --code-bg: #242220;
  --table-bg: #242220;
  --table-haze: #2a2826;
  --table-border: #2a2826;
  --footer-bg: #1a1918;
  --post-bg: #242220;
  --choice-bg: #242220;
  --shadow: rgba(0, 0, 0, 0.3);
  --translucent: rgba(255, 255, 255, 0.05);
  --translucent-light: rgba(255, 255, 255, 0.08);
}

/* System dark mode preference */
@media (prefers-color-scheme: dark) {
  html:not([data-mode="lit"]) {
    --bg: #1f1e1d;
    --light: #faf9f5;
    --haze: #242220;
    --xhaze: #2a2826;
    --gray: #faf9f5;
    --text: #faf9f5;
    --text-hover: #d97757;
    --header-text: #faf9f5;
    --theme: #d97757;
    --accent: #d97757;
    --code-bg: #242220;
    --table-bg: #242220;
    --table-haze: #2a2826;
    --table-border: #2a2826;
    --footer-bg: #1a1918;
    --post-bg: #242220;
    --choice-bg: #242220;
    --shadow: rgba(0, 0, 0, 0.3);
    --translucent: rgba(255, 255, 255, 0.05);
    --translucent-light: rgba(255, 255, 255, 0.08);
  }
}

/* ===== BASE TYPOGRAPHY ===== */
html {
  font-size: 16px;
}

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

/* Headings - Serif for editorial feel */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: 1.25rem; font-weight: 500; }
h5, h6 { font-size: 1rem; font-weight: 500; }

/* Code - Monospace */
code, pre, .code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Links */
a {
  color: var(--theme);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--text-hover);
}

/* ===== HEADER & NAVIGATION ===== */
.nav_header {
  background-color: #1f1e1d;
  border-bottom: 1px solid rgba(250, 249, 245, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav_brand {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.25rem;
  color: #faf9f5 !important;
  letter-spacing: -0.02em;
}

.nav_brand:hover {
  color: #d97757 !important;
}

.nav_brand img {
  max-height: 4rem;
  width: auto;
}

.nav_item {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  color: #b0aea5;
  transition: color 0.2s ease;
}

.nav_item:hover,
.nav_item.active {
  color: #faf9f5 !important;
}

/* ===== BUTTONS ===== */
.button,
button,
.button_translucent {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  letter-spacing: -0.005em;
}

.button {
  background-color: var(--gray) !important;
  border-color: var(--gray) !important;
  color: var(--bg) !important;
}

.button:hover {
  background-color: var(--theme) !important;
  border-color: var(--theme) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.button_translucent {
  color: var(--text) !important;
  border-color: var(--xhaze) !important;
  background-color: var(--haze) !important;
}

.button_translucent:hover {
  background-color: var(--xhaze) !important;
  border-color: var(--theme) !important;
}

/* ===== POSTS & CARDS ===== */
.post,
.post_card,
.card {
  background-color: var(--post-bg);
  border-radius: 16px;
  border: 1px solid var(--xhaze);
  transition: all 0.2s ease;
}

.post:hover,
.post_card:hover {
  border-color: var(--theme);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.post_title {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text);
}

.post_title a {
  color: var(--text);
}

.post_title a:hover {
  color: var(--theme);
}

.post_meta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0.7;
  font-weight: 500;
}

.post_excerpt {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  opacity: 0.9;
}

/* ===== TAGS ===== */
.post_tag,
.tag {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.25rem 1rem;
  border-radius: 9999px;
  background-color: var(--haze) !important;
  color: var(--text) !important;
  border: 1px solid var(--xhaze) !important;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.post_tag:hover,
.tag:hover {
  background-color: var(--theme) !important;
  color: var(--bg) !important;
  border-color: var(--theme) !important;
  transform: translateY(-1px);
}

/* ===== BACK TO TOP BUTTON ===== */
.to_top {
  width: 3rem !important;
  height: 3rem !important;
  border-radius: 9999px !important;
  background-color: var(--gray) !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  transition: all 0.2s ease !important;
}

.to_top:hover {
  background-color: var(--theme) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2) !important;
}

.to_top svg {
  fill: var(--bg) !important;
}

/* ===== LANGUAGE TOGGLE ===== */
.lang_toggle {
  position: relative;
  display: inline-block;
  margin: 0 0.5rem;
}

.lang_toggle input {
  display: none;
}

.lang_label {
  width: 3rem;
  height: 1.5rem;
  background-color: rgba(250, 249, 245, 0.15);
  border-radius: 9999px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(250, 249, 245, 0.2);
}

.lang_label:hover {
  background-color: rgba(250, 249, 245, 0.25);
  border-color: rgba(217, 119, 87, 0.5);
}

.lang_flag {
  font-size: 1.1rem;
  position: absolute;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1.5rem;
}

.lang_flag_pt { left: 0.6rem; }
.lang_flag_en { right: 0.6rem; }

.lang_toggle input:not(:checked) + .lang_label .lang_flag_pt { opacity: 1; }
.lang_toggle input:not(:checked) + .lang_label .lang_flag_en { opacity: 0; }
.lang_toggle input:checked + .lang_label .lang_flag_pt { opacity: 0; }
.lang_toggle input:checked + .lang_label .lang_flag_en { opacity: 1; }

.lang_animate {
  animation: lang-pulse 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes lang-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ===== COLOR MODE TOGGLE ===== */
.color_mode {
  position: relative;
  display: inline-block;
  margin: 0 0.5rem;
}

.color_mode svg {
  fill: #b0aea5;
  transition: fill 0.2s ease;
}

.color_mode:hover svg {
  fill: #faf9f5;
}

/* Social icons in header */
.follow a svg {
  fill: #b0aea5;
  transition: fill 0.2s ease;
}

.follow a:hover svg {
  fill: #d97757;
}

/* ===== FOOTER ===== */
.footer {
  background-color: var(--footer-bg);
  border-top: 1px solid var(--xhaze);
  padding: 3rem 0;
  margin-top: 4rem;
}

.footer a {
  color: var(--text);
  opacity: 0.8;
}

.footer a:hover {
  color: var(--theme);
  opacity: 1;
}

/* ===== CODE BLOCKS ===== */
pre,
.code {
  background-color: var(--code-bg);
  border: 1px solid var(--xhaze);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}

pre code,
.code code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Inline code */
code:not(pre code) {
  background-color: var(--haze);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.875em;
  color: var(--theme);
}

/* ===== TABLES ===== */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--table-border);
}

th {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  background-color: var(--table-haze);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: var(--table-haze);
}

/* ===== BLOCKQUOTES ===== */
blockquote {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.8;
  color: var(--text);
  border-left: 3px solid var(--theme);
  padding-left: 1.5rem;
  margin: 2rem 0;
  opacity: 0.9;
}

blockquote cite {
  font-size: 0.9rem;
  font-style: normal;
  color: var(--text);
  opacity: 0.7;
}

/* ===== SELECTION ===== */
::selection {
  background-color: var(--theme);
  color: var(--bg);
}

::-moz-selection {
  background-color: var(--theme);
  color: var(--bg);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--haze);
}

::-webkit-scrollbar-thumb {
  background: var(--xhaze);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--theme);
}

/* ===== FOCUS STATES ===== */
:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media screen and (max-width: 769px) {
  .nav_body {
    overflow-y: auto !important;
    max-height: 100vh;
    padding-bottom: 5rem !important;
    z-index: 1000 !important;
    background-color: var(--bg);
  }

  .follow {
    flex-wrap: wrap;
    justify-content: center !important;
    margin-top: 1rem;
    padding-bottom: 2rem;
  }

  .lang_toggle,
  .color_mode {
    z-index: 1001;
    position: relative;
    margin: 0.5rem !important;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  blockquote {
    font-size: 1.1rem;
    padding-left: 1rem;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .nav_header,
  .footer,
  .to_top,
  .follow,
  .lang_toggle,
  .color_mode {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: var(--theme);
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== UTILITY CLASSES ===== */
.text-serif { font-family: var(--font-serif); }
.text-sans { font-family: var(--font-sans); }
.text-mono { font-family: var(--font-mono); }
