/* ============================================================
   Jiolau — styles.css
   Dark theme · indigo + cyan · rich animations
   ============================================================ */

@property --hero-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

:root {
  --bg:          #0a0a0f;
  --bg-2:        #0e0e15;
  --surface:     #12121a;
  --surface-2:   #1a1a24;
  --line:        rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text:        #f5f5f7;
  --text-dim:    #a0a0b0;
  --text-mute:   #6b6b7a;
  --accent:      #6366f1;
  --accent-2:    #06b6d4;
  --accent-soft: rgba(99, 102, 241, 0.18);
  --danger:      #f87171;
  --grad:        linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);

  --radius-sm: 10px;
  --radius:    16px;
  --radius-lg: 24px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow:    0 18px 40px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.65);
  --glow:      0 0 0 0 rgba(99, 102, 241, 0);
  --glow-on:   0 12px 40px -8px rgba(99, 102, 241, 0.55);

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --container: 1200px;
}

/* -------- Reset-ish -------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }
h1, h2, h3, h4 {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.15;
}
p { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -40px; left: 8px;
  padding: 8px 12px; background: var(--accent); color: #fff;
  border-radius: var(--radius-sm); z-index: 1000;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 8px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

/* -------- Header -------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 15, 0.55);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), padding 0.3s var(--ease);
}
.site-header.scrolled {
  background: rgba(10, 10, 15, 0.82);
  border-bottom-color: var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 0;
  transition: padding 0.3s var(--ease);
}
.site-header.scrolled .header-inner { padding: 12px 0; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.logo-mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--grad);
  position: relative;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}
.logo-mark::after {
  content: "";
  position: absolute;
  top: -2px; right: -2px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
}
.logo-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.site-nav {
  display: flex;
  gap: 28px;
  margin-left: 16px;
}
.site-nav a {
  position: relative;
  font-size: 14.5px;
  color: var(--text-dim);
  padding: 6px 0;
  transition: color 0.2s var(--ease);
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1.5px;
  background: var(--grad);
  transition: width 0.3s var(--ease);
}
.site-nav a:hover { color: var(--text); }
.site-nav a:hover::after,
.site-nav a:focus-visible::after { width: 100%; }

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text-dim);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface); }

/* Mobile nav toggle (pure CSS) */
.nav-toggle { display: none; }
.nav-toggle-btn {
  display: none;
  margin-left: auto;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: pointer;
  position: relative;
}
.nav-toggle-btn span {
  position: absolute;
  left: 9px; right: 9px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s var(--ease), top 0.3s var(--ease);
}
.nav-toggle-btn span:nth-child(1) { top: 13px; }
.nav-toggle-btn span:nth-child(2) { top: 19px; }
.nav-toggle-btn span:nth-child(3) { top: 25px; }

/* -------- Buttons -------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1;
  transition: transform 0.2s var(--ease), box-shadow 0.3s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn-lg { padding: 15px 26px; font-size: 15.5px; }
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--glow-on); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.22); }

/* -------- Hero -------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(72px, 12vw, 140px) 0 clamp(72px, 10vw, 120px);
  isolation: isolate;
}
.hero-bg {
  position: absolute; inset: 0;
  z-index: -1;
  pointer-events: none;
}
.hero-conic {
  position: absolute; inset: -40%;
  background:
    conic-gradient(
      from var(--hero-angle),
      rgba(99, 102, 241, 0.45),
      rgba(6, 182, 212, 0.35),
      rgba(139, 92, 246, 0.40),
      rgba(99, 102, 241, 0.45)
    );
  filter: blur(80px);
  opacity: 0.55;
  animation: spin 24s linear infinite;
}
@keyframes spin {
  to { --hero-angle: 360deg; }
}
.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  will-change: transform;
  transition: transform 0.4s var(--ease);
}
.blob-1 { width: 420px; height: 420px; top: -100px;  left: -120px; background: radial-gradient(closest-side, rgba(99, 102, 241, 0.85), transparent); }
.blob-2 { width: 340px; height: 340px; top: 40%;     right: -80px; background: radial-gradient(closest-side, rgba(6, 182, 212, 0.75),  transparent); }
.blob-3 { width: 280px; height: 280px; bottom: -60px; left: 30%;   background: radial-gradient(closest-side, rgba(139, 92, 246, 0.65), transparent); }
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 40%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 40%, transparent 75%);
}

.hero-inner {
  position: relative;
  max-width: 900px;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 28px;
}
.hero-title {
  font-size: clamp(40px, 7vw, 80px);
  line-height: 1.02;
  margin-bottom: 22px;
  min-height: 1.1em;
}
.hero-title .caret {
  display: inline-block;
  color: var(--accent-2);
  margin-left: 4px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

#typewriter { background: linear-gradient(180deg, #fff 0%, #c7c7d4 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

.hero-sub {
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 36px;
}
.hero-ctas {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 64px;
}
.scroll-hint {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-mute);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.scroll-hint svg { animation: bounce 1.8s var(--ease) infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}

/* -------- Stats -------- */
.stats {
  padding: 40px 0 80px;
  border-bottom: 1px solid var(--line);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.stat { text-align: center; }
.stat-num {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(30px, 4.5vw, 52px);
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-label { color: var(--text-dim); font-size: 14px; }

/* -------- Section heads -------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}
.section-title {
  font-size: clamp(26px, 3vw, 36px);
}
.section-link { color: var(--accent-2); font-weight: 500; font-size: 14.5px; transition: opacity 0.2s; }
.section-link:hover { opacity: 0.8; }
.section-sub { color: var(--text-dim); font-size: 14.5px; }

/* -------- Featured -------- */
.featured { padding: 80px 0; }
.featured-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.featured-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.featured-media {
  display: block;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 10;
}
.featured-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}
.featured-card:hover .featured-media img { transform: scale(1.04); }

.chip {
  position: absolute;
  top: 16px; left: 16px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  color: var(--text);
}
.chip-sm { position: static; display: inline-block; font-size: 10.5px; padding: 4px 9px; margin-bottom: 10px; background: var(--accent-soft); border-color: transparent; color: #c7d2fe; }

.featured-title {
  font-size: clamp(22px, 2.6vw, 30px);
  margin-bottom: 16px;
}
.featured-title a { background-image: linear-gradient(var(--accent-2), var(--accent-2)); background-size: 0% 1.5px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size 0.35s var(--ease); }
.featured-title a:hover { background-size: 100% 1.5px; }
.featured-excerpt { color: var(--text-dim); margin-bottom: 24px; font-size: 16px; }

.byline { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line-strong);
}
.byline-name { font-weight: 600; font-size: 14.5px; }
.byline-meta { color: var(--text-mute); font-size: 13px; }

/* -------- Latest grid -------- */
.latest { padding: 40px 0 100px; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.card-media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}
.card:hover .card-media img { transform: scale(1.05); }
.card-body { padding: 20px; }
.card-title { font-size: 18px; line-height: 1.3; margin-bottom: 12px; }
.card-title a { transition: color 0.2s; }
.card-title a:hover { color: var(--accent-2); }
.card-meta { color: var(--text-mute); font-size: 13px; }

/* -------- Categories -------- */
.categories {
  padding: 80px 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(6, 182, 212, 0.06), transparent 50%),
    var(--bg);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.category-tile {
  display: block;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.category-tile:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.45);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.category-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-2);
  margin-bottom: 18px;
  transition: transform 0.4s var(--ease);
}
.category-tile:hover .category-icon { transform: rotate(-8deg) scale(1.05); }
.category-tile h3 { font-size: 18px; margin-bottom: 8px; }
.category-tile p { color: var(--text-dim); font-size: 14px; }

/* -------- Newsletter -------- */
.newsletter {
  padding: 80px 0;
}
.newsletter-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  align-items: center;
  gap: 40px;
  padding: clamp(32px, 5vw, 56px);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at 0% 100%, rgba(99, 102, 241, 0.35), transparent 60%),
    radial-gradient(ellipse at 100% 0%, rgba(6, 182, 212, 0.28), transparent 60%),
    #101019;
  border: 1px solid var(--line-strong);
  overflow: hidden;
}
.newsletter-inner::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(6, 182, 212, 0.2), transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.newsletter h2 {
  font-size: clamp(24px, 3vw, 34px);
  margin-bottom: 10px;
}
.newsletter p { color: var(--text-dim); }
.newsletter-form {
  display: flex;
  gap: 8px;
  background: rgba(10, 10, 15, 0.55);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px;
}
.newsletter-form input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  padding: 10px 16px;
  font-size: 15px;
  min-width: 0;
}
.newsletter-form input::placeholder { color: var(--text-mute); }
.newsletter-form input:focus-visible { outline: 0; }
.newsletter-form .btn { flex-shrink: 0; }

/* -------- Footer -------- */
.site-footer {
  padding: 80px 0 40px;
  background: #07070b;
  border-top: 1px solid var(--line);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line);
}
.footer-brand p { color: var(--text-dim); margin-top: 14px; max-width: 320px; }
.socials { display: flex; gap: 10px; margin-top: 20px; }
.socials a {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text-dim);
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.socials a:hover { color: var(--text); border-color: var(--accent); transform: translateY(-2px); }
.site-footer h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin-bottom: 16px;
}
.site-footer ul li { margin-bottom: 10px; }
.site-footer ul a { color: var(--text-dim); font-size: 14.5px; transition: color 0.2s; }
.site-footer ul a:hover { color: var(--text); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 32px;
  color: var(--text-mute);
  font-size: 13px;
}

/* -------- Reveal animation -------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* -------- Toast -------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  z-index: 100;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* -------- Focus -------- */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 4px;
}

/* -------- Responsive -------- */
@media (max-width: 1023px) {
  .card-grid     { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid    { grid-template-columns: repeat(2, 1fr); gap: 32px; }
  .featured-card { grid-template-columns: 1fr; }
  .footer-grid   { grid-template-columns: 1fr 1fr; gap: 32px; }
  .newsletter-inner { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .nav-toggle-btn { display: block; }
  .header-actions { display: none; }
  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 8px 20px 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease);
    margin-left: 0;
  }
  .site-nav a {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }
  .site-nav a:last-child { border-bottom: 0; }
  .nav-toggle:checked ~ .site-nav { max-height: 320px; }
  .nav-toggle:checked ~ .nav-toggle-btn span:nth-child(1) { top: 19px; transform: rotate(45deg); }
  .nav-toggle:checked ~ .nav-toggle-btn span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-toggle-btn span:nth-child(3) { top: 19px; transform: rotate(-45deg); }

  .card-grid     { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .footer-grid   { grid-template-columns: 1fr; }
  .footer-bottom { justify-content: center; text-align: center; }
  .hero-ctas     { flex-direction: column; align-items: stretch; }
  .hero-ctas .btn { width: 100%; }
  .newsletter-form { flex-direction: column; border-radius: var(--radius); padding: 8px; }
  .newsletter-form input { padding: 14px 16px; }
  .newsletter-form .btn { width: 100%; padding: 14px; border-radius: 999px; }
}

/* -------- Reduced motion -------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .hero-conic { animation: none; }
  .reveal { opacity: 1; transform: none; }
  .caret { display: none; }
  .scroll-hint svg { animation: none; }
}
