/* =========================================================
   Maccan — Personal site
   Dark · Modern · Technical · Premium
   ========================================================= */

:root {
  /* palette */
  --bg: #0a0c10;
  --bg-2: #0f1218;
  --surface: #12161e;
  --surface-2: #161b25;
  --border: #1f2630;
  --border-strong: #2a3442;
  --text: #e6edf3;
  --text-dim: #9aa4b2;
  --text-mute: #7d8796;

  /* accents */
  --accent: #60a5fa;          /* marine blue — primary brand accent */
  --accent-2: #38bdf8;        /* cyan */
  --accent-3: #a78bfa;        /* violet */
  --accent-skogsnod: #86efac; /* mint green — reserved for Skogsnod */
  --danger: #f87171;
  --warn: #fbbf24;

  /* effects */
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 60px -20px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 0 1px rgba(134,239,172,0.15), 0 20px 60px -20px rgba(134,239,172,0.25); /* Skogsnod glow */

  /* typography */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* layout */
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a.link { color: var(--accent); border-bottom: 1px dashed rgba(96,165,250,0.4); }
a.link:hover { color: #bfdbfe; }

::selection { background: rgba(96,165,250,0.25); color: #fff; }

/* ============== Background atmosphere ============== */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: -2;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%);
}

.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(56,189,248,0.10), transparent 60%),
    radial-gradient(700px 500px at 10% 10%, rgba(167,139,250,0.10), transparent 60%),
    radial-gradient(800px 500px at 50% 110%, rgba(96,165,250,0.08), transparent 60%);
}

/* ============== NAV ============== */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  max-width: var(--maxw); margin: 0 auto;
  padding: 18px 28px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: linear-gradient(180deg, rgba(10,12,16,0.85), rgba(10,12,16,0.55));
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.brand {
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 700; letter-spacing: -0.01em;
}
.brand-mark {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  background: linear-gradient(160deg, #131923, #0b0e13);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(96,165,250,0.08), 0 8px 24px -10px rgba(0,0,0,0.6);
}
.brand-mark.sm { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
.brand-text { font-size: 15px; }
.brand-dot { color: var(--accent); }

.nav-links {
  display: flex; gap: 26px;
  font-size: 14px; color: var(--text-dim);
}
.nav-links a { transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }
.nav-links a.is-active {
  color: var(--text);
  position: relative;
}
.nav-links a.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}

/* Focus-visible — keyboard accessibility */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.nav-cta {
  font-size: 13px; font-weight: 500;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  transition: all 0.2s ease;
}
.nav-cta:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

@media (max-width: 760px) {
  .nav-links { display: none; }
}

/* ============== HERO ============== */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

.hero {
  padding: 110px 0 100px;
  text-align: left;
  max-width: 880px;
}

.hero-tag {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
  background: rgba(18,22,30,0.6);
  margin-bottom: 28px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(96,165,250,0.18);
  animation: pulse 2.4s ease-in-out infinite;
}

/* Skogsnod-variant of hero-tag (mint glow) */
.hero-tag-skogsnod {
  border-color: rgba(134,239,172,0.25);
  background: rgba(134,239,172,0.04);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(134,239,172,0.08), 0 10px 30px -12px rgba(134,239,172,0.18);
}
.hero-tag-skogsnod .status-dot {
  background: var(--accent-skogsnod);
  box-shadow: 0 0 0 4px rgba(134,239,172,0.18);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.hero-title {
  font-size: clamp(40px, 6.4vw, 76px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 22px;
  font-weight: 800;
  background: linear-gradient(180deg, #fff 0%, #b9c2cf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.accent {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: clamp(17px, 1.6vw, 21px);
  color: var(--text-dim);
  max-width: 680px;
  margin: 0 0 38px;
}
.hl { color: var(--text); font-weight: 500; }

.hero-cta {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 56px;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px;
  border-radius: 12px;
  font-size: 15px; font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}
.btn-sm { padding: 10px 16px; font-size: 14px; }

.btn-primary {
  background: linear-gradient(180deg, #1a2330, #11161e);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px rgba(96,165,250,0.12) inset, 0 8px 24px -10px rgba(0,0,0,0.6);
}
.btn-primary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(96,165,250,0.25) inset, 0 14px 36px -12px rgba(96,165,250,0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  max-width: 620px;
}
.hero-meta > div { display: flex; flex-direction: column; gap: 4px; }
.meta-k {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.meta-v { font-size: 14px; color: var(--text); font-weight: 500; }

@media (max-width: 600px) {
  .hero { padding: 80px 0 70px; }
  .hero-meta { grid-template-columns: 1fr; gap: 12px; }
}

/* ============== SECTIONS ============== */
.section {
  padding: 90px 0;
  border-top: 1px solid var(--border);
}

.section-head {
  margin-bottom: 48px;
  max-width: 720px;
}
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(96,165,250,0.06);
  border: 1px solid rgba(96,165,250,0.15);
}
.section-head h2 {
  font-size: clamp(28px, 3.6vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  font-weight: 700;
}
.section-sub {
  color: var(--text-dim);
  font-size: 16px;
  margin: 0;
}

/* ============== ABOUT ============== */
.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 36px;
  align-items: start;
}
.about-text p {
  color: var(--text-dim);
  font-size: 16px;
  margin: 0 0 18px;
}
.about-text strong { color: var(--text); font-weight: 600; }
.about-text em { color: var(--accent); font-style: normal; font-weight: 500; }

.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-mute);
}
.card-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(96,165,250,0.6);
}
.card-pre {
  margin: 0;
  padding: 22px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
}
.c-key { color: var(--accent-2); }
.c-str { color: var(--accent); }
.c-ok  { color: var(--accent); font-weight: 600; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
}

/* ============== STACK ============== */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.stack-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.stack-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(400px 200px at var(--mx, 50%) var(--my, 0%), rgba(96,165,250,0.08), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.stack-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
}
.stack-card:hover::before { opacity: 1; }
.stack-icon { font-size: 24px; margin-bottom: 14px; }
.stack-card h3 {
  font-size: 16px; margin: 0 0 12px; font-weight: 600;
  letter-spacing: -0.01em;
}
.stack-card ul {
  margin: 0; padding: 0; list-style: none;
  font-size: 14px; color: var(--text-dim);
}
.stack-card li {
  padding: 5px 0;
  font-family: var(--font-mono);
  font-size: 13px;
}
.stack-card li::before {
  content: '→ ';
  color: var(--accent);
}

@media (max-width: 860px) { .stack-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stack-grid { grid-template-columns: 1fr; } }

/* ============== PROJECTS ============== */
.project-feature {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 0;
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: var(--shadow-glow);
}
.project-feature-meta { padding: 44px 44px 44px 44px; }
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid;
}
.badge-live {
  color: var(--accent-skogsnod);
  border-color: rgba(134,239,172,0.3);
  background: rgba(134,239,172,0.06);
}
.project-title {
  font-size: clamp(32px, 4vw, 44px);
  margin: 18px 0 8px;
  letter-spacing: -0.03em;
  font-weight: 700;
  background: linear-gradient(120deg, #fff 0%, var(--accent-skogsnod) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.project-tagline {
  color: var(--text);
  font-size: 17px;
  margin: 0 0 18px;
  font-weight: 500;
}
.project-desc { color: var(--text-dim); font-size: 15px; margin: 0 0 22px; }
.project-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 24px;
}
.project-tags span {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
}

.project-feature-visual {
  position: relative;
  min-height: 320px;
  background: radial-gradient(circle at 50% 50%, #131a24 0%, #0a0d12 100%);
  border-left: 1px solid var(--border);
  overflow: hidden;
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.55;
}
.orb-1 { width: 280px; height: 280px; background: var(--accent-skogsnod); top: -60px; right: -60px; }
.orb-2 { width: 240px; height: 240px; background: var(--accent-2); bottom: -60px; left: -40px; opacity: 0.4; }
.grid-overlay {
  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: 32px 32px;
}
.logo-mark {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 140px;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 8px 40px rgba(134,239,172,0.4);
  letter-spacing: -0.05em;
}
.logo-mark span {
  display: inline-grid; place-items: center;
  width: 180px; height: 180px;
  border-radius: 36px;
  background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
}

@media (max-width: 860px) {
  .project-feature { grid-template-columns: 1fr; }
  .project-feature-meta { padding: 32px; }
  .project-feature-visual { min-height: 220px; border-left: none; border-top: 1px solid var(--border); }
  .logo-mark { font-size: 90px; }
  .logo-mark span { width: 120px; height: 120px; border-radius: 24px; }
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  transition: all 0.25s ease;
}
.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}
.project-card h4 {
  font-size: 16px; margin: 0 0 10px;
  font-weight: 600; letter-spacing: -0.01em;
}
.project-card p {
  font-size: 14px; color: var(--text-dim);
  margin: 0 0 14px;
}
.proj-stack {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  opacity: 0.85;
}

@media (max-width: 860px) { .project-grid { grid-template-columns: 1fr; } }

/* ============== PRINCIPLES ============== */
.principles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.principle {
  position: relative;
  padding: 28px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.25s ease;
}
.principle:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.p-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  display: inline-block;
}
.principle h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.principle p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14.5px;
}

@media (max-width: 720px) { .principles { grid-template-columns: 1fr; } }

/* ============== CONTACT ============== */
.section-contact { padding: 90px 0 110px; }
.contact-card {
  position: relative;
  padding: 60px 50px;
  background:
    radial-gradient(800px 300px at 50% 0%, rgba(96,165,250,0.08), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  overflow: hidden;
}
.contact-card .eyebrow { margin-bottom: 18px; }
.contact-card h2 {
  font-size: clamp(28px, 3.4vw, 40px);
  margin: 0 0 14px;
  letter-spacing: -0.025em;
}
.contact-card p {
  color: var(--text-dim);
  max-width: 540px;
  margin: 0 auto 32px;
  font-size: 16px;
}
.contact-links {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
}

@media (max-width: 600px) {
  .contact-card { padding: 44px 24px; }
}

/* ============== FOOTER ============== */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.footer-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-mute);
}
.footer-inner > div:first-child {
  display: inline-flex; align-items: center; gap: 12px;
}
.footer-name { color: var(--text-dim); font-weight: 500; }
.footer-meta { display: inline-flex; align-items: center; gap: 10px; }
.footer-meta .dot { opacity: 0.5; }
.mono { font-family: var(--font-mono); font-size: 12px; }

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

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

/* ============== ERROR PAGES (404, 403, 500, 503) ============== */
.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 80px 28px;
  position: relative;
}
.error-wrap {
  max-width: 720px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
}
.error-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(120px, 22vw, 220px);
  line-height: 0.95;
  letter-spacing: -0.06em;
  margin: 0;
  background: linear-gradient(180deg, #fff 0%, #2a3442 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 30px 80px rgba(96,165,250,0.15);
}
.error-code.code-skogsnod {
  background: linear-gradient(180deg, #fff 0%, var(--accent-skogsnod) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.error-status {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  margin-bottom: 22px;
  background: rgba(18,22,30,0.6);
}
.error-status .status-dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(251,191,36,0.18); }
.error-status.is-down .status-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(248,113,113,0.18); }
.error-status.is-mint .status-dot { background: var(--accent-skogsnod); box-shadow: 0 0 0 4px rgba(134,239,172,0.18); }

.error-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 14px 0 14px;
  background: linear-gradient(180deg, #fff 0%, #b9c2cf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.error-desc {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 520px;
  margin: 0 auto 32px;
}
.error-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.error-terminal {
  margin: 36px auto 0;
  max-width: 540px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.error-terminal .card-head { font-size: 12px; }
.error-terminal pre {
  margin: 0;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}
.term-err { color: var(--danger); }
.term-warn { color: var(--warn); }
.term-ok { color: var(--accent-skogsnod); }
.term-dim { color: var(--text-mute); }
