/* === Reset & Base === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* === Dark theme (default) === */
:root, [data-theme="dark"] {
  --amber:      #C8960C;
  --amber-dim:  #A07808;
  --cyan:       #0D9488;
  --cyan-dim:   #0F766E;

  --bg:             #020617;
  --surface:        #0F172A;
  --text-primary:   #F8FAFC;
  --text-secondary: #94A3B8;
  --border-subtle:  rgba(255,255,255,0.08);
  --glass-bg:       rgba(15, 23, 42, 0.55);
  --glass-border:   rgba(255,255,255,0.08);
  --glass-shadow:   0 8px 32px rgba(0,0,0,0.4);
  --card-icon-bg:   rgba(255,255,255,0.06);
  --foooter-text:   #475569;
}

/* === Light theme === */
[data-theme="light"] {
  --bg:             #F8FAFC;
  --surface:        #FFFFFF;
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --border-subtle:  rgba(0,0,0,0.08);
  --glass-bg:       rgba(255,255,255,0.72);
  --glass-border:   rgba(0,0,0,0.08);
  --glass-shadow:   0 8px 32px rgba(0,0,0,0.08);
  --card-icon-bg:   rgba(0,0,0,0.04);
  --foooter-text:   #94A3B8;
}

[data-theme="light"] .hero-section .hero-title,
[data-theme="light"] .hero-section .hero-subtitle {
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
[data-theme="light"] .scroll-arrow {
  border-color: rgba(0,0,0,0.4);
}

:root {
  --radius-lg:       24px;
  --radius-md:       16px;
  --radius-sm:       10px;
  --transition-fast: 0.2s cubic-bezier(0.25,0.1,0.25,1);
  --transition-smooth: 0.4s cubic-bezier(0.25,0.1,0.25,1);
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter','Noto Sans SC',-apple-system,BlinkMacSystemFont,'SF Pro Display','Segoe UI',sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition-smooth), color var(--transition-smooth);
}

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

/* === Navigation — Frosted Glass === */
.nav-glass {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  transition: background var(--transition-smooth);
}

.nav-glass.scrolled { background: var(--glass-bg); }

.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 32px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
}

.nav-right { display: flex; align-items: center; gap: 24px; }

.nav-brand {
  font-size: 1.2rem; font-weight: 600;
  letter-spacing: -0.02em; color: var(--text-primary);
}

.nav-links { list-style: none; display: flex; gap: 32px; }

.nav-link {
  font-size: 0.9rem; font-weight: 500; color: var(--text-secondary);
  position: relative; padding: 4px 0; transition: color var(--transition-fast);
}

.nav-link::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 0; height: 2px; background: var(--amber);
  border-radius: 1px; transition: width var(--transition-smooth);
}

.nav-link:hover, .nav-link.active { color: var(--text-primary); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

/* === Theme toggle button === */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--card-icon-bg);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: background var(--transition-fast);
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(200,150,12,0.15); }
.theme-toggle svg { color: var(--text-secondary); transition: color var(--transition-fast); }
.theme-toggle:hover svg { color: var(--amber); }

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

/* === Hero Section === */
.hero-section {
  position: relative; height: 100vh; min-height: 700px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

[data-theme="dark"] .hero-section { cursor: none; }
[data-theme="light"] .hero-section { cursor: none; }

.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}

.base-bg { background-image: url('/pics/monza.jpg'); }

/* Canvas draws 2ferrari.jpg, mouse erases it → monza shows through */
.eraser-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%; z-index: 2;
}

.hero-content { position: relative; z-index: 10; text-align: center; padding: 32px; }

/* === Custom cursor dot === */
.cursor-dot {
  position: fixed; pointer-events: none; z-index: 200;
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.85);
  box-shadow: 0 0 8px rgba(255,255,255,0.4);
  transform: translate(-50%,-50%);
  display: none; transition: opacity 0.15s;
  mix-blend-mode: difference;
}

/* === Avatar === */
.avatar-placeholder {
  width: 120px; height: 120px; margin: 0 auto 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth);
  overflow: hidden;
}

.avatar-placeholder:hover { transform: scale(1.05); border-color: var(--amber); }

.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* === Hero Typography === */
.hero-title {
  font-size: clamp(2.5rem,6vw,5rem); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 12px;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: 1.1rem; font-weight: 400; color: var(--text-secondary);
  letter-spacing: 0.03em;
}

/* === Scroll Hint === */
.hero-scroll-hint {
  position: absolute; bottom: 40px; left: 50%;
  transform: translateX(-50%); z-index: 10;
}

.scroll-arrow {
  display: block; width: 28px; height: 28px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(45deg);
  animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%,100% { opacity: 0.4; transform: rotate(45deg) translate(0,0); }
  50%     { opacity: 1;   transform: rotate(45deg) translate(-6px,-6px); }
}

/* === Section Panel === */
.section-panel {
  position: relative; padding: 100px 32px 120px;
  max-width: 1200px; margin: 0 auto; z-index: 1;
}

.section-header { text-align: center; margin-bottom: 64px; }

.section-tag {
  display: inline-block; font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 12px;
}

.section-title {
  font-size: clamp(2rem,4vw,3rem); font-weight: 700;
  letter-spacing: -0.02em;
}

/* === Glass Cards === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth);
  cursor: default;
  display: block;
}

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

.glass-card.category-card { cursor: pointer; }

.card-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  background: var(--card-icon-bg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px; color: var(--cyan);
  transition: background var(--transition-fast);
}

.glass-card:hover .card-icon { background: rgba(13,148,136,0.15); }
.glass-card h3  { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.glass-card p   { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }

.category-count-badge {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--amber);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 4px 12px;
}

/* === Back Link === */
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.9rem; font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 32px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.back-link:hover {
  color: var(--text-primary);
  border-color: var(--amber);
}

.back-link svg { flex-shrink: 0; }

/* === Category Page === */
.category-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 100px 24px 120px;
}

.category-header {
  text-align: center;
  margin-bottom: 48px;
}

.category-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 12px;
}

.empty-hint {
  text-align: center;
  color: var(--text-secondary);
  padding: 60px 0;
  font-size: 1rem;
}

/* === Article List === */
.article-list { display: flex; flex-direction: column; max-width: 860px; margin: 0 auto; }

.article-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 28px 8px; border-bottom: 1px solid var(--glass-border);
  transition: padding var(--transition-smooth);
}

.article-row:hover { padding-left: 20px; }
.article-info { min-width: 0; }

.article-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.06em; color: var(--amber); margin-bottom: 6px;
}

.article-tag a {
  color: var(--amber);
  border-bottom: 1px dashed var(--amber);
  padding-bottom: 1px;
  transition: opacity var(--transition-fast);
}

.article-tag a:hover { opacity: 0.7; }

.article-info h3 { font-size: 1.05rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.article-info p  { font-size: 0.9rem; color: var(--text-secondary); }

.article-date { font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap; }

/* === Post Page === */
.post-container { max-width: 780px; margin: 80px auto 80px; padding: 0 24px; }

.post-header { margin-bottom: 40px; text-align: center; }

.post-category-tag {
  display: inline-block; font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.08em; color: var(--amber); margin-bottom: 12px;
}

.post-title {
  font-size: clamp(1.6rem,3.5vw,2.6rem); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.3; margin-bottom: 12px;
  color: var(--text-primary);
}

.post-date { font-size: 0.88rem; color: var(--text-secondary); }

.post-body { font-size: 1.05rem; line-height: 1.85; color: var(--text-primary); }

.post-body p { margin-bottom: 1.2em; }
.post-body img { display: block; max-width: 100%; height: auto; border-radius: var(--radius-md); margin: 0 auto 28px; }

/* === Footer === */
.footer-glass {
  text-align: center; padding: 40px 32px;
  border-top: 1px solid var(--glass-border);
}

.footer-glass p { font-size: 0.85rem; color: var(--foooter-text); }

/* === Responsive === */
@media (max-width: 768px) {
  .nav-inner      { padding: 0 20px; }
  .nav-links      { gap: 20px; }
  .section-panel  { padding: 80px 20px 100px; }
  .card-grid      { grid-template-columns: 1fr; gap: 16px; }
  .hero-title     { font-size: 2rem; }
  .hero-subtitle  { font-size: 0.95rem; }
}
