/* ITGATE AS — site.css — Phase 1 redesign */

/* ─── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:       #F0EEE6;
  --bg-card:  #E9E5DA;
  --ink:      #1a1815;
  --ink-soft: #4a463f;
  --accent:   #D97757;
  --ink-blue: #2c4a6e;
  --line:     rgba(26, 24, 21, 0.14);
}

/* ─── Reset & base ───────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 18px;
  line-height: 1.65;
}

body {
  /* No background here: it would paint over the fixed #sceneCanvas at
     z-index -1. The html element carries the cream background. */
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: Georgia, 'Times New Roman', ui-serif, serif;
  color: var(--ink);
  line-height: 1.2;
}

h2 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-bottom: 2rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

p {
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

a {
  color: var(--ink-blue);
  text-decoration: none;
}

/* ─── Depth layer: floating ANSI debris behind everything ───────────────── */
#sceneCanvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* ─── Layout helpers ─────────────────────────────────────────────────────── */
section, footer, .hero {
  position: relative;
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 7rem 1.5rem;
}

.section-inner > h2 {
  will-change: transform;
}

.section-inner--narrow {
  max-width: 680px;
}

/* ─── Nav ────────────────────────────────────────────────────────────────── */
#siteNav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: var(--bg);
  border-bottom: 1px solid var(--line);
  transform: translateY(-100%);
  transition: transform 0.35s ease;
}

#siteNav.visible {
  transform: translateY(0);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo img {
  display: block;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--ink-blue);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  position: relative;
  padding-bottom: 2px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: width 0.25s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg);
  overflow: hidden;
}

.hero-canvas-wrap {
  position: absolute;
  inset: 0;
}

#logoCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-canvas-wrap noscript img {
  position: absolute;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(66vw, 860px);
}

.hero-tagline {
  position: absolute;
  top: 64%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  font-family: Georgia, 'Times New Roman', ui-serif, serif;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  color: var(--ink-soft);
  text-align: center;
  letter-spacing: 0.01em;
  animation: tagline-in 1.2s ease 1.9s both;
}

@keyframes tagline-in {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-tagline { animation: none; }
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  opacity: 0.55;
  animation: hint-bob 2.4s ease-in-out infinite;
}

.scroll-arrow {
  font-size: 1rem;
}

@keyframes hint-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(5px); }
}

/* ─── Sections — fade-in-up ──────────────────────────────────────────────── */
.fade-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Scrub scenes: tall sections with a sticky 100vh stage ─────────────── */
.scrub {
  height: 250vh;
}

#historien.scrub {
  height: 330vh;
}

.scrub .stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Statements that fade through while the ANSI wall rises */
.statement {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 92%;
  max-width: 900px;
  text-align: center;
  font-family: Georgia, 'Times New Roman', ui-serif, serif;
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  line-height: 1.15;
  color: var(--ink);
  opacity: 0;
  margin: 0;
  will-change: transform, opacity;
}

.statement em {
  font-style: italic;
  color: var(--accent);
}

/* ─── Project panels: full-width chapters, not cards ────────────────────── */
#prosjekter .section-head {
  padding-bottom: 1rem;
}

.project-panel {
  position: relative;
  min-height: 88vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 1.5rem;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.panel--flip .panel-art { order: 2; }
.panel--flip .panel-body { order: 1; }

/* Giant chapter number drifting behind the content */
.panel-num {
  position: absolute;
  top: 8%;
  right: 2%;
  z-index: 0;
  font-family: Georgia, 'Times New Roman', ui-serif, serif;
  font-size: clamp(7rem, 18vw, 15rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px rgba(26, 24, 21, 0.13);
  pointer-events: none;
  will-change: transform;
}

.panel--flip .panel-num {
  right: auto;
  left: 2%;
}

/* Generated ANSI-art fragment */
.panel-art {
  position: relative;
  z-index: 1;
  display: block;
  background-color: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1.2rem, 3vw, 2.6rem);
  text-decoration: none;
  overflow: hidden;
  will-change: transform, clip-path;
  transition: box-shadow 0.3s ease;
}

.panel-art:hover {
  box-shadow: 0 22px 60px rgba(26, 24, 21, 0.18);
}

.panel-art::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    circle at var(--gx, 50%) var(--gy, 50%),
    rgba(255, 252, 245, 0.5),
    rgba(255, 252, 245, 0) 55%
  );
  transition: opacity 0.3s ease;
}

.panel-art:hover::after { opacity: 1; }

.panel-art pre {
  margin: 0;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: clamp(13px, 1.6vw, 22px);
  line-height: 1.05;
  letter-spacing: 0.06em;
  color: var(--ink);
  will-change: transform;
  transition: transform 0.45s ease;
}

.panel-art pre.tilting {
  transition: none;
}

.panel-art .g-ink   { color: var(--ink); }
.panel-art .g-terra { color: var(--accent); }
.panel-art .g-blue  { color: var(--ink-blue); }

.panel-body {
  position: relative;
  z-index: 1;
  will-change: transform, opacity;
}

.panel-tag {
  display: inline-block;
  font-variant: small-caps;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--ink-blue);
  margin-bottom: 0.8rem;
}

.panel-body h3 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  margin-bottom: 1rem;
}

.panel-body h3 a {
  color: var(--ink);
  text-decoration: none;
}

.panel-body h3 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

.panel-body p {
  font-size: 1.08rem;
  max-width: 46ch;
}

.panel-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

.panel-link:hover {
  color: var(--ink);
  border-color: var(--ink);
}

@media (max-width: 820px) {
  .project-panel {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 4rem 1.5rem;
  }
  .panel--flip .panel-art { order: 0; }
  .panel--flip .panel-body { order: 1; }
}

/* ─── Tunnel scene ───────────────────────────────────────────────────────── */
.tunnel-title {
  position: absolute;
  top: 7vh;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
}

.milestone {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 92%;
  max-width: 620px;
  text-align: center;
  opacity: 0;
  will-change: transform, opacity;
}

.milestone h3 {
  font-size: clamp(3.4rem, 9vw, 6.5rem);
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.milestone p {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--ink-soft);
}

/* ─── BBS terminal (kontakt) ─────────────────────────────────────────────── */
.terminal {
  position: relative;
  background-color: #161310;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(26, 24, 21, 0.25);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  background-color: #211d18;
}

.terminal-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background-color: rgba(240, 238, 230, 0.25);
}

.terminal-dot:first-child { background-color: var(--accent); }

.terminal-title {
  margin-left: 0.6rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  color: rgba(240, 238, 230, 0.55);
}

.terminal pre {
  margin: 0;
  min-height: 14.5em;
  padding: 1.4rem 1.6rem 0.2rem;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.98rem;
  line-height: 1.55;
  color: #e8e2d4;
  white-space: pre-wrap;
}

.terminal pre a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.terminal-cursor {
  display: inline-block;
  margin: 0 0 1.2rem 1.6rem;
  color: var(--accent);
  animation: cursor-blink 1.06s steps(1) infinite;
}

/* CRT scanlines over the terminal */
.terminal::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0 1px,
    transparent 1px 3px
  );
}

@keyframes cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ─── Reduced motion: every scene readable without animation ────────────── */
@media (prefers-reduced-motion: reduce) {
  .scrub, #historien.scrub { height: auto; }
  .scrub .stage { position: static; height: auto; overflow: visible; padding: 5rem 0; }
  .stage canvas { display: none; }
  .statement, .milestone {
    position: static;
    opacity: 1;
    transform: none;
    margin: 3.5rem auto;
  }
  .tunnel-title { position: static; transform: none; text-align: center; }
  .panel-art { clip-path: none !important; }
  .panel-body { opacity: 1 !important; transform: none !important; }
  .panel-art::after { display: none; }
  .terminal-cursor { animation: none; }
}

/* ─── Om / Kontakt sections ──────────────────────────────────────────────── */
#om p,
#kontakt p {
  font-size: 1.05rem;
  max-width: 60ch;
}

.link-email {
  color: var(--ink-blue);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s;
}

.link-email:hover {
  text-decoration-color: var(--ink-blue);
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--line);
  background-color: var(--bg);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-copy {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 0;
  opacity: 0.7;
}

.footer-artifact {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-bottom: 0;
  opacity: 0.55;
}

.footer-artifact img {
  display: block;
  opacity: 0.6;
}
