/* ============================================================
   massimopadovan.it — design tokens
   monochrome, dark, weight-contrast sans
   ============================================================ */

:root {
  /* surfaces — near-blacks with a clear purple cast */
  --bg:        oklch(0.150 0.028 295);
  --bg-1:      oklch(0.185 0.032 295);
  --bg-2:      oklch(0.225 0.036 295);
  --line:      oklch(0.310 0.038 295);
  --line-soft: oklch(0.245 0.034 295);

  /* ink — off-whites with a hint of purple */
  --ink:       oklch(0.970 0.010 295);
  --ink-2:     oklch(0.785 0.020 295);
  --ink-3:     oklch(0.590 0.028 295);
  --ink-4:     oklch(0.435 0.034 295);

  /* accent (used sparingly for SVG animations) */
  --violet:    oklch(0.70 0.18 295);
  --violet-2:  oklch(0.58 0.22 290);

  /* state (functional only — no brand accent) */
  --positive:  oklch(0.78 0.14 145);
  --danger:    oklch(0.70 0.18 25);

  /* type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;

  /* scale */
  --t-xs:   11px;
  --t-sm:   13px;
  --t-base: 15px;
  --t-md:   17px;
  --t-lg:   22px;
  --t-xl:   32px;
  --t-2xl:  48px;
  --t-3xl:  72px;
  --t-4xl:  104px;

  /* radii / shadow */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --shadow-soft: 0 1px 0 0 oklch(1 0 0 / 0.04) inset, 0 24px 60px -24px oklch(0 0 0 / 0.6);

  /* layout */
  --maxw: 1180px;
  --gutter: clamp(20px, 4vw, 48px);

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    /* purple aurora top-right */
    radial-gradient(ellipse 1200px 800px at 88% -8%, oklch(0.40 0.18 295 / 0.45), transparent 60%),
    /* purple aurora bottom-left */
    radial-gradient(ellipse 1000px 700px at -8% 108%, oklch(0.34 0.16 285 / 0.35), transparent 60%),
    /* dot grid */
    radial-gradient(circle at 1px 1px, oklch(0.95 0.05 295 / 0.12) 1px, transparent 0),
    /* major grid lines (every 4 dots) */
    linear-gradient(to right,  oklch(0.85 0.05 295 / 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(0.85 0.05 295 / 0.055) 1px, transparent 1px),
    /* minor grid lines */
    linear-gradient(to right,  oklch(0.85 0.05 295 / 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(0.85 0.05 295 / 0.025) 1px, transparent 1px);
  background-size:
    100% 100%,
    100% 100%,
    32px 32px,
    128px 128px,
    128px 128px,
    32px 32px,
    32px 32px;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
  background-attachment: fixed, fixed, fixed, fixed, fixed, fixed, fixed;
}

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

a {
  color: inherit;
  text-decoration: none;
  position: relative;
  transition: color .25s var(--ease);
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
}
.link::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  transform: scaleX(0.2);
  opacity: .3;
  transition: transform .35s var(--ease), opacity .35s var(--ease);
}
.link:hover { color: var(--ink); }
.link:hover::after { transform: scaleX(1); opacity: 1; }

button { font: inherit; cursor: pointer; }

/* ---------- layout primitives ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.hairline { height: 1px; background: var(--line-soft); width: 100%; }

/* ---------- top nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in oklch, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: var(--t-sm);
  color: var(--ink-2);
}
.nav-links a { transition: color .2s var(--ease); }
.nav-links a:hover { color: var(--ink); }

/* logo block — reused everywhere */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.logo svg { display: block; }
.logo-text { font-size: var(--t-sm); }
.logo-text .dim { color: var(--ink-3); font-weight: 400; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-1);
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { background: var(--bg-2); border-color: oklch(0.36 0.006 260); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover { background: oklch(0.88 0.004 90); border-color: oklch(0.88 0.004 90); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--bg-1); }

/* ---------- pill / tag ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: var(--t-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in oklch, var(--bg-1) 50%, transparent);
}
.pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--positive) 18%, transparent);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--positive) 28%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in oklch, var(--positive) 0%, transparent); }
}

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, color-mix(in oklch, var(--bg-1) 80%, transparent), color-mix(in oklch, var(--bg) 90%, transparent));
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.card:hover { border-color: var(--line); }

/* ---------- type helpers ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}
.display {
  font-size: clamp(40px, 8vw, 104px);
  font-weight: 600;
  line-height: 0.96;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
.display .thin { font-weight: 200; color: var(--ink-2); }
.display .ital { font-style: italic; font-weight: 300; color: var(--ink-2); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: clamp(28px, 4vw, 48px); line-height: 1.05; }
h3 { font-size: var(--t-lg); }
p  { color: var(--ink-2); text-wrap: pretty; }

.dim { color: var(--ink-3); }
.mono { font-family: var(--font-mono); }

/* ---------- form ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field label {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: var(--t-base);
  transition: border-color .2s var(--ease), background .2s var(--ease);
  font-family: var(--font-sans);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--ink-2);
  background: var(--bg-2);
}
.field textarea { resize: vertical; min-height: 140px; }

/* caret blink */
.caret {
  display: inline-block;
  width: 0.06em;
  height: 0.9em;
  background: currentColor;
  margin-left: 0.04em;
  vertical-align: -0.06em;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* glitch text */
.glitch {
  position: relative;
  display: inline-block;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0;
}
.glitch.go::before {
  animation: glitch-a 2.4s steps(1) infinite;
  color: oklch(0.85 0.04 200);
  mix-blend-mode: screen;
}
.glitch.go::after {
  animation: glitch-b 2.4s steps(1) infinite;
  color: oklch(0.65 0.04 30);
  mix-blend-mode: screen;
}
@keyframes glitch-a {
  0%, 92%, 100% { opacity: 0; transform: translate(0); }
  93% { opacity: 0.7; transform: translate(-2px, 0); }
  95% { opacity: 0;   transform: translate(0); }
  97% { opacity: 0.5; transform: translate(1px, -1px); }
}
@keyframes glitch-b {
  0%, 90%, 100% { opacity: 0; transform: translate(0); }
  91% { opacity: 0.6; transform: translate(2px, 1px); }
  94% { opacity: 0;   transform: translate(0); }
  96% { opacity: 0.4; transform: translate(-1px, 0); }
}

/* fade-in on load */
.fade-in {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp .8s var(--ease) forwards;
}
.fade-in.d1 { animation-delay: .1s; }
.fade-in.d2 { animation-delay: .2s; }
.fade-in.d3 { animation-delay: .35s; }
.fade-in.d4 { animation-delay: .5s; }
.fade-in.d5 { animation-delay: .7s; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* footer */
.footer {
  border-top: 1px solid var(--line-soft);
  padding: 56px 0 40px;
  margin-top: 120px;
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.footer a:hover { color: var(--ink); }
.footer-cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer h4 {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin-bottom: 18px;
}
.footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-4);
  letter-spacing: 0.04em;
}

/* generic page hero */
.page-hero {
  padding: 100px 0 40px;
  border-bottom: 1px solid var(--line-soft);
}
.page-hero h1 {
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-top: 14px;
}

/* prose for legal pages */
.prose { max-width: 760px; padding: 60px 0 80px; }
.prose h2 { font-size: var(--t-lg); margin: 48px 0 12px; color: var(--ink); }
.prose h3 { font-size: var(--t-md); margin: 28px 0 8px; color: var(--ink); }
.prose p, .prose li { color: var(--ink-2); font-size: var(--t-base); }
.prose ul { padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-1);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  color: var(--ink);
}
.prose .meta {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin-bottom: 24px;
}

/* lang toggle */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--bg-1);
}
.lang-toggle button {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.lang-toggle button.active {
  background: var(--ink);
  color: var(--bg);
}
.lang-toggle button:not(.active):hover { color: var(--ink); }

/* responsive */
@media (max-width: 800px) {
  .nav-links { gap: 16px; }
  .nav-links .hide-sm { display: none; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: 12px; align-items: flex-start; }
}
