/* ==========================================================================
   Permafrost Development,util.css
   Single semantic-class stylesheet. No utility classes, no Tailwind here ;
   twlocal.css (Tailwind preflight) supplies only the base reset.
   ========================================================================== */

:root{
  --void-rgb: 10,7,20;
  --void-opaque: #120b23;     /* was rgba(55,32,82,1),same gradient mechanism, retinted */
  --panel: rgba(203,224,235,0.05);
  --panel-solid: #140f26;
  --panel-border: rgba(191,232,240,0.14);
  --panel-border-hover: rgba(191,232,240,0.30);

  --frost: #dcf1f6;
  --frost-dim: #a9c6d1;
  --aurora: #5fe0b5;
  --aurora-dim: rgba(95,224,181,0.55);
  --ember: #c8703f;
  --ember-600: #a95833;

  --text: #e7ecf4;
  --muted: #8b93ab;
  --muted-2: #5b6178;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 24px;
  --max-width: 1120px;
  --header-h: 74px;

  --ff-display: 'Space Grotesk', sans-serif;
  --ff-body: 'Inter', sans-serif;
  --ff-mono: 'IBM Plex Mono', monospace;
  --ease: cubic-bezier(.16,.8,.24,1);

  /* legacy aliases kept so any stray references elsewhere don't break */
  --bg: var(--void-opaque);
  --card: var(--panel-solid);
  --accent: var(--ember);
  --accent-600: var(--ember-600);
  --text-old: var(--text);
  --bg-base: var(--void-opaque);
  --ui-bg: rgba(10,7,20,0.9);
  --ui-fg: var(--frost);
}

/* ==========================================================================
   Particle background simulation,layering contract, do not remove.
   #fluid-sim / .background-simulation sit at z-index -1 behind everything.
   html/body's translucent tint + .main-content's own gradient (below) are
   what let the simulation read as "behind frosted glass" instead of raw.
   ========================================================================== */
#fluid-sim { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; display: block; z-index: -1; pointer-events: none; }
.background-simulation { position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: none; z-index: -1; }
.fluid-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -50; background-color: transparent; }

* { box-sizing: border-box; }
html { height:100%; margin:0; font-family: var(--ff-body); color: var(--text); background: rgba(var(--void-rgb),0.76); -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
body { height:100%; margin:0; font-family: var(--ff-body); color: var(--text); -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--aurora); outline-offset: 3px; border-radius: 4px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); display: flex; align-items: center; background: rgba(10,7,20,0.62); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid var(--panel-border); padding: 0 1.5rem; }
.site-brand { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; max-width: var(--max-width); margin: 0 auto; }
.brand-link { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; }
.brand-link img { width: 34px; height: 34px; flex: none; border-radius: 6px; }
.brand-word { font-family: var(--ff-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--frost); line-height: 1; display: block; }
.brand-tag { display: block; font-family: var(--ff-mono); font-size: .62rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-top: .2rem; }
.site-header-sub { display: none; } /* tagline now lives inline as .brand-tag; kept selector to avoid breaking old refs */

.nav-toggle { display: none; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--panel-border); border-radius: 8px; background: none; cursor: pointer; }
.nav-toggle span { display: block; width: 16px; height: 1.5px; background: var(--frost); position: relative; }
.nav-toggle span::before, .nav-toggle span::after { content: ''; position: absolute; left: 0; width: 16px; height: 1.5px; background: var(--frost); }
.nav-toggle span::before { top: -5px; } .nav-toggle span::after { top: 5px; }

.site-nav { display: flex; align-items: center; }
.nav-list { list-style: none; padding: 0; margin: 0; display: flex; gap: .25rem; }
.nav-item {}
.nav-link { font-family: var(--ff-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: .55rem .9rem; display: inline-block; border-radius: 999px; transition: color .18s var(--ease), background .18s var(--ease); }
.nav-link:hover { color: var(--frost); background: rgba(255,255,255,0.04); }
.nav-link.is-active { color: var(--void-opaque); background: var(--aurora); }

.main-content {
  max-width: none; margin: 0; padding: 0;
  /* Preserved mechanism: opaque near the top, fading to transparent by the
     midpoint so the simulation shows through below the fold. */
  background: linear-gradient(to bottom, var(--void-opaque) 0%, var(--void-opaque) 35%, transparent 50%);
}

/* Hero */
.hero { padding: clamp(1.5rem, 6vw, 3rem) 1.5rem clamp(1.5rem,6vw,3rem); max-width: var(--max-width); margin: 0 auto; text-align: left; color: #fff; }
.hero-title { margin: 0 0 1.25rem 0; font-family: var(--ff-display); color: var(--frost); font-size: clamp(2.3rem,5.4vw,4rem); line-height: 1.15; letter-spacing: -0.01em; max-width: 16ch; }
.hero-title em { font-style: normal; color: var(--aurora); }
.hero-sub { margin: 0 0 2.25rem 0; color: var(--muted); font-size: clamp(1rem,1.4vw,1.15rem); max-width: 52ch; line-height: 1.65; }
.hero-actions { display: flex; gap: .9rem; flex-wrap: wrap; margin-bottom: 2.75rem; }
.hero-meta { display: flex; gap: 1.5rem; flex-wrap: wrap; font-family: var(--ff-mono); font-size: .74rem; color: var(--muted-2); letter-spacing: .03em; list-style: none; padding: 0; }
.hero-meta strong { color: var(--frost-dim); font-weight: 500; }

.eyebrow { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--ff-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--aurora); margin: 0 0 1rem 0; }
.eyebrow.muted { color: var(--muted); }
.eyebrow .rune { width: 14px; height: 14px; opacity: .9; }

.rune-rule { display: flex; align-items: center; gap: 1rem; margin: 1rem auto; max-width: var(--max-width); padding: 0 1.5rem; }
.rune-rule::before, .rune-rule::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--panel-border-hover), transparent); }
.rune-rule svg { width: 18px; height: 18px; flex: none; opacity: .75; }

/* Generic container and section */
.container { font-family: var(--ff-display); max-width: var(--max-width); margin: 0 auto; padding: 3.5rem 1.5rem 4rem; }
.container.highlights {padding: clamp(1.5rem, 6vw, 3rem) 1.5rem clamp(1.5rem,6vw,3rem);}
.section-title { font-family: var(--ff-display); font-size: clamp(1.4rem,2.4vw,1.9rem); margin: 0 0 .75rem 0; color: var(--frost); line-height: 1.15; }
.section-text { font-family: var(--ff-display); color: var(--text); margin: 0 0 1.1rem 0; line-height: 1.75; max-width: 66ch; }
.section-text:last-child { margin-bottom: 0; }
.section-lede { color: var(--muted); max-width: 60ch; line-height: 1.65; margin: 0 0 2.25rem 0; font-size: 1rem; }

/* Grid / cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 1.1rem; align-items: start; }
.card { position: relative; color: var(--muted); background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 1.5rem; backdrop-filter: blur(6px); transition: transform .22s var(--ease), border-color .22s var(--ease), background .22s var(--ease); }
.card:hover { transform: translateY(-3px); border-color: var(--panel-border-hover); background: rgba(203,224,235,0.075); }
.card-title { margin: 0 0 .55rem 0; font-family: var(--ff-display); font-size: 1.08rem; color: var(--frost); }
.card-text { margin: 0 0 1.3rem 0; color: var(--muted); font-size: .92rem; line-height: 1.6; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-cta { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; background: transparent; border: 1px dashed var(--panel-border-hover); }

.card-tag { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--ff-mono); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 .9rem 0; }
.card-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.card-tag.status-active .dot { background: var(--aurora); }
.card-tag.status-prototype .dot { background: var(--ember); }
.card-tag.status-archived .dot { background: var(--muted-2); }

.chip { font-family: var(--ff-mono); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; color: var(--frost-dim); border: 1px solid var(--panel-border); padding: .4rem .75rem; border-radius: 999px; display: inline-block; }

/* Projects listing */
.project-list { display: flex; flex-direction: column; gap: .85rem; }
.project-item { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 1.25rem 1.5rem; transition: border-color .2s var(--ease), background .2s var(--ease); }
.project-item:hover { border-color: var(--panel-border-hover); background: rgba(203,224,235,0.075); }
.project-item.is-stub { opacity: .62; }
.project-item-main { max-width: 62ch; }
.project-title { margin: 0 0 .4rem 0; font-family: var(--ff-display); font-size: 1.05rem; color: var(--frost); }
.project-link { color: var(--frost); text-decoration: none; font-weight: 600; }
.project-link:hover { color: var(--aurora); }
.project-desc { color: var(--muted); margin: 0; font-size: .92rem; line-height: 1.6; }

/* Breadcrumb */
.project-breadcrumb { display: flex; align-items: center; gap: .5rem; font-family: var(--ff-mono); font-size: .74rem; color: var(--muted); margin: 0 0 2rem 0; padding: 0; }
.project-breadcrumb__link { color: var(--muted); text-decoration: none; transition: color .15s; }
.project-breadcrumb__link:hover { color: var(--aurora); }
.project-breadcrumb__sep { opacity: .5; }
.project-breadcrumb__current { color: var(--frost-dim); }

/* Project detail */
.project-hero { margin: 0 0 2.5rem 0; }
.project-hero .project-title { font-size: clamp(1.7rem,3.6vw,2.4rem); margin: 0 0 .75rem 0; }
.project-subtitle { color: var(--muted); font-size: 1.05rem; max-width: 60ch; line-height: 1.6; margin: 0 0 1.25rem 0; }
.project-meta { display: flex; flex-wrap: wrap; gap: .55rem; list-style: none; padding: 0; margin: 0; color: var(--muted); font-family: var(--ff-mono); font-size: .78rem; }

.project-section { margin: 0 0 2.75rem 0; }
.project-section__title { font-family: var(--ff-mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--aurora); margin: 0 0 1.1rem 0; }
.project-section__text { color: var(--text); line-height: 1.75; max-width: 66ch; margin: 0; }

.feature-list { display: grid; gap: .65rem; padding: 0; margin: 0; list-style: none; }
.feature-list__item { display: flex; gap: .7rem; color: var(--text); line-height: 1.55; font-size: .96rem; }
.feature-list__item::before { content: ''; width: 6px; height: 6px; margin-top: .55rem; flex: none; background: var(--ember); border-radius: 1px; transform: rotate(45deg); }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); gap: 1rem; }
.gallery-item { margin: 0; overflow: hidden; border-radius: var(--radius-sm); }
.gallery-item__img { width: 100%; aspect-ratio: 16/10; border-radius: var(--radius-sm); border: 1px solid var(--panel-border); display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem; background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 2px, transparent 2px 14px), linear-gradient(155deg, var(--tile-a,#22314a), var(--tile-b,#151233)); font-family: var(--ff-mono); font-size: .72rem; color: var(--muted); letter-spacing: .02em; }
.gallery-item:nth-child(3n+1) .gallery-item__img { --tile-a:#1c3a3a; --tile-b:#0f1a2b; }
.gallery-item:nth-child(3n+2) .gallery-item__img { --tile-a:#3a2a4a; --tile-b:#150f26; }
.gallery-item:nth-child(3n+3) .gallery-item__img { --tile-a:#3a2519; --tile-b:#160f1c; }
/* Real photos/clips: <img>/<video class="gallery-item__img">,same box, no placeholder pattern/padding */
img.gallery-item__img, video.gallery-item__img { padding: 0; object-fit: cover; background-image: none; background-color: var(--panel-solid); transition: transform .3s var(--ease); display: block; width: 100%; height: 100%; }
.gallery-item:hover img.gallery-item__img, .gallery-item:hover video.gallery-item__img { transform: scale(1.03); }
.gallery-item__caption { color: var(--muted-2); font-size: .82rem; margin-top: .6rem; }

.tech-specs { display: grid; grid-template-columns: auto 1fr; gap: .6rem 1.5rem; margin: 0; }
.tech-specs dt { font-family: var(--ff-mono); font-size: .78rem; color: var(--muted); white-space: nowrap; }
.tech-specs dd { color: var(--text); font-size: .92rem; margin: 0; }

.project-cta { border-top: 1px solid var(--panel-border); padding-top: 2rem; margin-top: 3rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.project-cta__text { color: var(--muted); max-width: 46ch; font-size: .92rem; margin: 0; }
.project-cta__actions { display: flex; gap: .75rem; margin: 0; flex-wrap: wrap; }
.action-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--aurora); font-weight: 600; font-size: .92rem; text-decoration: none; }
.action-link:hover { color: var(--frost); }

.stub-panel { border: 1px dashed var(--panel-border-hover); border-radius: var(--radius); padding: 2rem; color: var(--muted); font-size: .94rem; line-height: 1.7; }
.stub-panel strong { color: var(--frost-dim); }

/* Media (single-image sections, e.g. Birka) */
.media { margin: 0 0 1rem 0; }
.media--narrow { max-width: 420px; }
.media-img { width: 100%; height: auto; border-radius: var(--radius-sm); display: block; }
.media-caption { color: var(--muted-2); font-size: .82rem; margin-top: .6rem; }

/* About */
.about-layout { display: grid; grid-template-columns: 280px 1fr; gap: 3rem; align-items: start; }
.about-emblem { aspect-ratio: 1; border-radius: var(--radius-lg); border: 1px solid var(--panel-border); background: radial-gradient(circle at 30% 20%, rgba(95,224,181,0.16), transparent 55%), radial-gradient(circle at 75% 80%, rgba(200,112,63,0.16), transparent 55%), var(--panel-solid); display: flex; align-items: center; justify-content: center; position: sticky; top: calc(var(--header-h) + 2rem); }
.about-emblem img { width: 38%; opacity: .9; }
.about-founders { margin: 1.5rem 0 0 0; padding-top: 1.5rem; border-top: 1px solid var(--panel-border); font-family: var(--ff-mono); font-size: .72rem; color: var(--muted); line-height: 1.8; }

/* Snippets */
.snippets-hero { margin-bottom: 1.5rem; }
.snippets-list { padding-top: 0 !important; }
.snippets-note { margin-top: 2.5rem; border-left: 2px solid var(--panel-border-hover); padding-left: 1.25rem; }
.card__title { margin: 0 0 .55rem 0; font-family: var(--ff-display); font-size: 1.08rem; color: var(--frost); }
.card__desc { margin: 0 0 1.3rem 0; color: var(--muted); font-size: .92rem; line-height: 1.6; }
.card__actions { margin: 0; }

/* Contact / forms */
.contact-layout { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 3rem; align-items: start; }
.contact-info { display: flex; flex-direction: column; gap: 1.5rem; }
.contact-info-item { border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.contact-info-item .label { font-family: var(--ff-mono); font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; display: block; }
.contact-info-item .value { color: var(--frost); font-size: 1rem; }
.contact-info-item .value a { color: inherit; text-decoration: none; }
.contact-info-item .value a:hover { color: var(--aurora); }

.contact-form { display: flex; flex-direction: column; gap: 1.1rem; max-width: none; }
.form-label { display: flex; flex-direction: column; gap: .5rem; color: var(--frost-dim); font-weight: 500; font-size: .85rem; }
.form-input, .form-textarea { padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--panel-border); background: rgba(255,255,255,0.03); color: var(--text); font-family: var(--ff-body); font-size: .95rem; transition: border-color .18s var(--ease), background .18s var(--ease); }
.form-input:focus, .form-textarea:focus { border-color: var(--aurora-dim); background: rgba(255,255,255,0.05); outline: none; }
.form-textarea { min-height: 140px; resize: vertical; }
.notice { padding: .9rem 1.1rem; border-radius: var(--radius-sm); }
.notice.success { background: rgba(95,224,181,0.12); color: var(--aurora); border: 1px solid rgba(95,224,181,0.3); }
.notice.error { background: rgba(200,80,80,0.12); color: #e39a9a; border: 1px solid rgba(200,80,80,0.3); }

/* Buttons */
.btn-primary, .btn-ghost { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; font-family: var(--ff-mono); font-size: .78rem; letter-spacing: .04em; font-weight: 500; padding: .8rem 1.3rem; border-radius: 999px; border: none; cursor: pointer; transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease); }
.btn-primary, .btn-ghost { text-align: center; }
.btn-primary:hover, .btn-ghost:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ember); color: #fff7f1; }
.btn-primary:hover { background: var(--ember-600); }
.btn-ghost { border: 1px solid var(--panel-border-hover); color: var(--frost); background: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,0.05); border-color: var(--frost-dim); }

/* Small utilities */
.list { padding-left: 1.1rem; color: var(--text); }
.list-item { margin-bottom: .5rem; }

/* Footer */
.site-footer { margin-top: 2.5rem; padding: 2.5rem 1.5rem; color: var(--muted-2); text-align: center; border-top: 1px solid var(--panel-border); }
.site-footer-inner { max-width: var(--max-width); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.copyright, .contact-line { font-family: var(--ff-mono); font-size: .74rem; color: var(--muted-2); margin: 0; }
.contact-line a.mailto { color: var(--muted); text-decoration: none; }
.contact-line a.mailto:hover { color: var(--aurora); }

/* Reveal-on-scroll (progressive enhancement, see footer.php) */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width:860px){
  .about-layout { grid-template-columns: 1fr; }
  .about-emblem { position: static; max-width: 220px; }
  .contact-layout { grid-template-columns: 1fr; }
}
@media (max-width:720px){
  .site-nav { position: absolute; top: var(--header-h); left: 0; right: 0; background: rgba(10,7,20,0.97); border-bottom: 1px solid var(--panel-border); flex-direction: column; padding: .5rem; display: none; }
  .site-nav.is-open { display: flex; }
  .nav-list { flex-direction: column; width: 100%; }
  .nav-link { display: block; padding: .9rem 1rem; }
  .nav-toggle { display: inline-flex; }
  .project-item { flex-direction: column; align-items: flex-start; }
  .project-cta { flex-direction: column; align-items: flex-start; }
  .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce){
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Particle-engine debug UI hook (kept for Particles/ scripts, if present) */
#source-ui {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 99999;
  background: var(--ui-bg);
  color: var(--ui-fg);
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  pointer-events: auto;
}
