/* ============================================================
   billypetersson.se — Billy Petersson, Azure / Cloud Engineer
   Aesthetic: technical editorial · blueprint-dark · azure→cyan
   ============================================================ */

:root {
  --font-display: 'Sora', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* azure accent ramp */
  --azure: #38bdf8;
  --azure-deep: #2563eb;
  --cyan: #5eead4;

  --maxw: 1120px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---- Dark (default) ---- */
[data-theme="dark"] {
  --bg: #0a0e17;
  --bg-2: #0e131f;
  --surface: rgba(255, 255, 255, .025);
  --surface-2: rgba(255, 255, 255, .045);
  --border: rgba(120, 160, 220, .14);
  --border-strong: rgba(120, 160, 220, .28);
  --text: #e8eef7;
  --text-dim: #8a98ad;
  --text-faint: #5a6678;
  --grid-line: rgba(120, 160, 220, .055);
  --glow-1: rgba(56, 189, 248, .16);
  --glow-2: rgba(37, 99, 235, .14);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .7);
}

/* ---- Light ---- */
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #eaeef6;
  --surface: rgba(20, 40, 80, .025);
  --surface-2: rgba(20, 40, 80, .05);
  --border: rgba(30, 60, 110, .12);
  --border-strong: rgba(30, 60, 110, .26);
  --text: #0d1626;
  --text-dim: #51607a;
  --text-faint: #8090a8;
  --grid-line: rgba(40, 80, 150, .06);
  --glow-1: rgba(56, 189, 248, .22);
  --glow-2: rgba(37, 99, 235, .12);
  --shadow: 0 24px 50px -28px rgba(30, 60, 110, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  transition: background .5s var(--ease), color .5s var(--ease);
}

/* ---------- Atmospheric background layers ---------- */
.bg-grid, .bg-glow, .bg-noise { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

.bg-grid {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 100% 70% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 100% 70% at 50% 0%, #000 40%, transparent 100%);
}

.bg-glow {
  background:
    radial-gradient(60% 50% at 78% 8%, var(--glow-1), transparent 60%),
    radial-gradient(55% 45% at 12% 18%, var(--glow-2), transparent 62%);
  animation: glow-drift 22s ease-in-out infinite alternate;
}
@keyframes glow-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-2%, 2%, 0) scale(1.08); }
}

.bg-noise {
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- Layout helpers ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 7rem) clamp(1.25rem, 5vw, 2.5rem);
}
.section__head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2.5rem; }
.section__index {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--azure);
  letter-spacing: .08em;
  padding-top: .35rem;
}
.section__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: -.02em;
  position: relative;
}
.section__title::after {
  content: ""; display: block; height: 1px; margin-top: 1.1rem;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

.accent { color: var(--azure); }
.lead { font-size: clamp(1.05rem, 1.8vw, 1.22rem); color: var(--text); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  max-width: var(--maxw); margin: 0 auto;
  padding: 1rem clamp(1.25rem, 5vw, 2.5rem);
  backdrop-filter: blur(12px);
}
.nav::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
  mask-image: linear-gradient(#000, #000);
}
.nav__brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); margin-right: auto; }
.nav__brand-mark {
  font-family: var(--font-mono); font-weight: 600; font-size: .82rem;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: 8px; color: var(--azure);
  background: var(--surface);
}
.nav__brand-text { font-family: var(--font-mono); font-size: .92rem; letter-spacing: -.01em; }
.nav__links { display: flex; gap: 1.4rem; }
.nav__links a {
  font-family: var(--font-mono); font-size: .82rem; color: var(--text-dim);
  text-decoration: none; letter-spacing: .01em; position: relative; padding: .2rem 0;
  transition: color .25s var(--ease);
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1px; width: 0;
  background: var(--azure); transition: width .3s var(--ease);
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after, .nav__links a:hover::after { width: 100%; }

.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); color: var(--text-dim); cursor: pointer;
  transition: color .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
.theme-toggle:hover { color: var(--azure); border-color: var(--azure); transform: translateY(-1px); }
.theme-toggle__moon { display: none; }
[data-theme="light"] .theme-toggle__sun { display: none; }
[data-theme="light"] .theme-toggle__moon { display: block; }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3rem, 9vw, 7rem) clamp(1.25rem, 5vw, 2.5rem) clamp(2rem, 5vw, 4rem);
  display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.eyebrow {
  font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim);
  letter-spacing: .04em; display: inline-flex; align-items: center; gap: .55rem; margin-bottom: 1.4rem;
}
.eyebrow__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--azure);
  box-shadow: 0 0 0 0 var(--azure); animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, .5); }
  70% { box-shadow: 0 0 0 9px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}
.hero__title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(3rem, 9vw, 6rem); line-height: .96; letter-spacing: -.035em;
  margin-bottom: 1.5rem;
  background: linear-gradient(180deg, var(--text) 55%, color-mix(in srgb, var(--text) 55%, var(--azure)) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lead { font-size: clamp(1.1rem, 2.2vw, 1.4rem); color: var(--text-dim); max-width: 30ch; margin-bottom: 2.2rem; }
.hero__lead strong { color: var(--text); font-weight: 600; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .8rem; }

.btn {
  font-family: var(--font-mono); font-size: .85rem; letter-spacing: .01em;
  padding: .72rem 1.3rem; border-radius: 10px; text-decoration: none;
  border: 1px solid var(--border-strong); color: var(--text); background: var(--surface);
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.btn:hover { transform: translateY(-2px); border-color: var(--azure); color: var(--azure); }
.btn--primary {
  background: linear-gradient(135deg, var(--azure), var(--azure-deep));
  color: #04121f; border-color: transparent; font-weight: 600;
  box-shadow: 0 10px 30px -10px var(--glow-1);
}
.btn--primary:hover { color: #04121f; transform: translateY(-2px); filter: brightness(1.07); }

/* ---------- Manifest card ---------- */
.manifest {
  border: 1px solid var(--border-strong); border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.manifest__bar {
  display: flex; align-items: center; gap: .45rem;
  padding: .7rem .9rem; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot--r { background: #ff5f57; } .dot--y { background: #febc2e; } .dot--g { background: #28c840; }
.manifest__file { font-family: var(--font-mono); font-size: .75rem; color: var(--text-faint); margin-left: .6rem; }
.manifest__code {
  margin: 0; padding: 1.2rem 1.3rem; font-family: var(--font-mono);
  font-size: clamp(.72rem, 1.4vw, .82rem); line-height: 1.75; overflow-x: auto;
  color: var(--text-dim);
}
.c-key { color: var(--azure-deep); } [data-theme="dark"] .c-key { color: #7aa2ff; }
.c-var { color: var(--text); }
.c-prop { color: var(--cyan); }
.c-str { color: var(--azure); }
.c-bool { color: #f0a868; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.6fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.about__text p + p { margin-top: 1.1rem; color: var(--text-dim); }
.about__text strong { color: var(--text); font-weight: 600; }
.about__facts { list-style: none; border-left: 1px solid var(--border-strong); }
.about__facts li { padding: .7rem 0 .7rem 1.2rem; display: flex; flex-direction: column; gap: .15rem; }
.about__facts li + li { border-top: 1px solid var(--border); }
.about__facts .k { font-family: var(--font-mono); font-size: .72rem; color: var(--azure); letter-spacing: .05em; text-transform: uppercase; }
.about__facts .v { color: var(--text); font-size: .96rem; }

/* ---------- Stack ---------- */
.stack { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.stack__card {
  border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem 1.6rem;
  background: var(--surface); transition: border-color .3s var(--ease), transform .3s var(--ease), background .3s var(--ease);
}
.stack__card:hover { border-color: var(--border-strong); transform: translateY(-3px); background: var(--surface-2); }
.stack__card h3 {
  font-family: var(--font-mono); font-size: .82rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-dim); margin-bottom: 1.1rem;
}
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
  font-size: .85rem; padding: .35rem .75rem; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.tag--core {
  border-color: color-mix(in srgb, var(--azure) 45%, transparent);
  color: var(--azure);
  background: color-mix(in srgb, var(--azure) 9%, transparent);
}

/* ---------- Timeline ---------- */
.timeline { list-style: none; position: relative; padding-left: 1.6rem; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px;
  background: linear-gradient(var(--border-strong), var(--border), transparent);
}
.timeline__item { position: relative; padding: 0 0 2.2rem 1.2rem; }
.timeline__item::before {
  content: ""; position: absolute; left: -1.6rem; top: 7px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--azure);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--azure) 12%, transparent);
}
.timeline__item--side::before { border-color: var(--text-faint); box-shadow: none; }
.timeline__period { font-family: var(--font-mono); font-size: .76rem; color: var(--azure); letter-spacing: .03em; }
.timeline__item--side .timeline__period { color: var(--text-faint); }
.timeline__role { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin: .3rem 0 .1rem; letter-spacing: -.01em; }
.timeline__role .at { color: var(--text-dim); font-weight: 500; }
.timeline__meta { font-family: var(--font-mono); font-size: .76rem; color: var(--text-faint); margin-bottom: .55rem; }
.timeline__meta a, .timeline__body a { color: var(--azure); text-decoration: none; border-bottom: 1px solid transparent; }
.timeline__meta a:hover, .timeline__body a:hover { border-color: var(--azure); }
.timeline__body p:last-child { color: var(--text-dim); font-size: .95rem; }
.timeline__earlier { position: relative; padding-left: 1.2rem; color: var(--text-faint); font-size: .9rem; }
.timeline__earlier::before {
  content: ""; position: absolute; left: -1.6rem; top: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--text-faint);
}
.timeline__earlier .timeline__period { display: block; margin-bottom: .2rem; }

/* ---------- Certifications ---------- */
.certs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.cert {
  display: flex; align-items: center; gap: 1rem;
  border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem 1.3rem;
  background: var(--surface); transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.cert:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.cert__badge {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 600; font-size: .9rem; color: #04121f;
  background: linear-gradient(135deg, var(--azure), var(--azure-deep));
}
.cert__badge--skill { background: linear-gradient(135deg, var(--cyan), var(--azure)); font-size: 1.1rem; }
.cert h3 { font-size: 1rem; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.cert p { font-family: var(--font-mono); font-size: .74rem; color: var(--text-dim); margin-top: .2rem; }
.cert__year { margin-left: auto; font-family: var(--font-mono); font-size: .82rem; color: var(--text-faint); align-self: flex-start; }
.certs__note { margin-top: 1.2rem; font-family: var(--font-mono); font-size: .78rem; color: var(--text-faint); }

/* ---------- Beyond ---------- */
.section--beyond .beyond { max-width: 760px; }
.beyond__list { list-style: none; margin-top: 1.8rem; display: grid; gap: 1rem; }
.beyond__list li { display: flex; align-items: center; gap: 1rem; color: var(--text-dim); }
.beyond__list strong { color: var(--text); font-weight: 600; }
.beyond__list a { color: var(--azure); text-decoration: none; border-bottom: 1px solid transparent; }
.beyond__list a:hover { border-color: var(--azure); }
.beyond__ic {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); color: var(--azure); font-size: 1rem; background: var(--surface);
}
.belt {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 8px; display: flex; gap: 2px;
  align-items: center; justify-content: center; background: #14161c;
  border: 1px solid var(--border-strong);
}
.belt i { width: 3px; height: 16px; background: #e8eef7; border-radius: 1px; }
.belt i.red { background: #e23b3b; }
[data-theme="light"] .belt { background: #1a1d24; }

/* ---------- Contact ---------- */
.section--contact { padding-bottom: clamp(4rem, 9vw, 8rem); }
.contact__lead { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--text); max-width: 40ch; margin-bottom: 2rem; }
.contact__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.contact__card {
  display: flex; flex-direction: column; gap: .35rem; text-decoration: none;
  border: 1px solid var(--border); border-radius: 14px; padding: 1.4rem 1.5rem;
  background: var(--surface); transition: border-color .3s var(--ease), transform .3s var(--ease), background .3s var(--ease);
}
.contact__card:hover { border-color: var(--azure); transform: translateY(-3px); background: var(--surface-2); }
.contact__k { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--azure); }
.contact__v { color: var(--text); font-size: 1rem; word-break: break-all; }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw); margin: 0 auto;
  padding: 2rem clamp(1.25rem, 5vw, 2.5rem); border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem;
  font-family: var(--font-mono); font-size: .78rem; color: var(--text-faint);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -999px; top: .5rem; z-index: 100;
  background: var(--azure); color: #04121f; padding: .5rem 1rem; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { left: .5rem; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }

:focus-visible { outline: 2px solid var(--azure); outline-offset: 3px; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; }
  .manifest { order: 2; }
  .about, .stack, .certs, .contact__grid { grid-template-columns: 1fr; }
  .nav__links { display: none; }
}
@media (max-width: 560px) {
  .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
