/* ------------------------------------------------------------------
   Noa Labuda — SIGNAL (portfolio v4)
   Mission-control aesthetic: deep black, bone white, signal orange.
   Type: Unbounded (display) / Manrope (body) / IBM Plex Mono (labels)
------------------------------------------------------------------- */

:root {
  --bg: #050505;
  --bg-2: #0c0b0a;
  --fg: #eae7df;
  --muted: #8b877d;
  --line: #23211d;
  --accent: #ff4d00;
  --accent-text: #ff6a2b; /* brighter accent reserved for small text (AA contrast) */
  --spark: #00f0ff;
  --font-display: "Unbounded", sans-serif;
  --font-body: "Manrope", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --font-serif: "Instrument Serif", serif;
  --ease: cubic-bezier(0.22, 0.61, 0.21, 1);
  --pad: clamp(1.25rem, 4vw, 4.5rem);
  --hud-h: 3.4rem;
}

* { box-sizing: border-box; }

html { background: var(--bg); }
html:not(.loaded) body { overflow: hidden; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 700px at 75% -10%, #14100c 0%, transparent 60%),
    radial-gradient(900px 700px at -10% 110%, #0d0c10 0%, transparent 55%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }
h1, h2, h3, p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.muted { color: var(--muted); }
.acc { color: var(--accent); }

/* small mono text in accent gets the brighter variant for readable contrast */
.mono.acc, .mono .acc { color: var(--accent-text); }

/* custom scrollbar */
html { scrollbar-width: thin; scrollbar-color: var(--line) var(--bg); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* language crossfade */
#app { transition: opacity 200ms ease; }
html.lang-fade #app { opacity: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

a:focus-visible, button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

/* ---------- Grain / canvas ---------- */

.grain {
  position: fixed;
  inset: -50%;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(4) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ---------- Loader ---------- */

#loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--pad);
  transition: clip-path 900ms cubic-bezier(0.76, 0, 0.24, 1);
  clip-path: inset(0 0 0 0);
}

html.loaded #loader {
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}

.loader-lines { color: var(--muted); }
.loader-lines .ok::after { content: " ... ok"; color: var(--accent); }

.loader-foot {
  display: flex;
  align-items: flex-end;
  gap: 2rem;
}

.loader-bar {
  flex: 1;
  height: 1px;
  background: var(--line);
  position: relative;
  margin-bottom: 1.4rem;
}

.loader-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.loader-pct {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3.5rem, 12vw, 9rem);
  line-height: 0.8;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- Cursor ---------- */

/* above every overlay (loader 10000, terminal 10002, palette 10003) */
#cursor { position: fixed; top: 0; left: 0; z-index: 10010; pointer-events: none; }

.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  translate: -50% -50%;
}

.cursor-dot { width: 5px; height: 5px; background: var(--accent); }

.cursor-ring {
  width: 36px;
  height: 36px;
  border: 1px solid color-mix(in srgb, var(--fg) 35%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 300ms var(--ease), height 300ms var(--ease),
    border-color 300ms var(--ease), background 300ms var(--ease);
}

.cursor-text {
  font-size: 0.55rem;
  color: var(--bg);
  opacity: 0;
  transition: opacity 200ms ease;
}

body.cursor-hover .cursor-ring {
  width: 58px;
  height: 58px;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

body.cursor-label .cursor-ring {
  width: 64px;
  height: 64px;
  background: var(--accent);
  border-color: var(--accent);
}

body.cursor-label .cursor-text { opacity: 1; }

@media (pointer: coarse) { #cursor { display: none; } }

/* the dot + ring replace the native cursor entirely on mouse devices */
@media (pointer: fine) {
  * { cursor: none !important; }
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 var(--pad);
  height: var(--hud-h);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hud-top { top: 0; border-bottom: 1px solid var(--line); }
.hud-bottom { bottom: 0; border-top: 1px solid var(--line); }

.logo { text-decoration: none; letter-spacing: 0.12em; }

.hud-status { color: var(--muted); display: flex; align-items: center; gap: 0.5rem; }

.hud-status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.2s ease infinite;
}

@keyframes pulse { 50% { opacity: 0.25; } }

.hud-right {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-switch button {
  color: var(--muted);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.25rem 0.1rem;
  transition: color 250ms ease;
}

.lang-switch button:hover { color: var(--fg); }

.lang-switch button.active {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
}

.hud-nav { display: flex; gap: 1.6rem; }

.hud-nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color 250ms ease;
}

.hud-nav a:hover, .hud-nav a:focus-visible { color: var(--fg); }
.hud-nav a.acc { color: var(--accent-text); }
.hud-nav a.active { color: var(--accent-text); }

/* generous tap areas without changing the visual height */
.hud-nav a { padding: 1.15rem 0.35rem; }

/* ---------- Rail ---------- */

.rail {
  position: fixed;
  left: 1.1rem;
  top: 50%;
  translate: 0 -50%;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.rail-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: border-color 250ms ease, color 250ms ease, transform 250ms var(--ease);
}

.rail-dot span { font-size: 0.5rem; }

.rail-dot:hover { transform: scale(1.2); }

.rail-dot.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Toast ---------- */

#toast {
  position: fixed;
  bottom: calc(var(--hud-h) + 1rem);
  left: 50%;
  translate: -50% 0;
  z-index: 9000;
  background: var(--accent);
  color: var(--bg);
  padding: 0.7rem 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease, translate 300ms var(--ease);
}

#toast.on { opacity: 1; translate: -50% -6px; }

/* ---------- Terminal ---------- */

#terminal {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

#terminal[hidden] { display: none; }

.term-win {
  width: min(680px, 92vw);
  height: min(430px, 70vh);
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.term-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.term-body {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  white-space: pre-wrap;
  text-transform: none;
  line-height: 1.75;
}

.term-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--line);
}

.term-line input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--accent);
  font: inherit;
  letter-spacing: inherit;
  text-transform: none;
}

/* ---------- Smooth wrapper ---------- */

#app { position: relative; z-index: 1; }

#app.smooth {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  will-change: transform;
}

/* ---------- Chapters ---------- */

.chapter {
  position: relative;
  padding: calc(var(--hud-h) + clamp(4rem, 10vh, 8rem)) var(--pad) clamp(6rem, 12vh, 10rem);
  max-width: 1550px;
  margin: 0 auto;
}

.ghost {
  position: absolute;
  top: var(--hud-h);
  right: var(--pad);
  z-index: -1;
  font-size: clamp(8rem, 24vw, 22rem);
  line-height: 0.8;
  font-family: var(--font-display);
  font-weight: 900;
  color: transparent;
  -webkit-text-stroke: 1px var(--line);
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.05em;
}

.ch-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  margin-bottom: clamp(2.5rem, 6vh, 4.5rem);
}

.ch-line { flex: 1; height: 1px; background: var(--line); }

.statement {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 4.6vw, 4rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  max-width: 24ch;
  margin-bottom: clamp(3rem, 7vh, 5.5rem);
}

/* word-mask reveal */
[data-split] .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}

[data-split] .wi {
  display: inline-block;
  transform: translateY(112%);
  transition: transform 900ms var(--ease);
  transition-delay: calc(var(--wi) * 60ms);
}

[data-split].in .wi { transform: translateY(0); }

/* accent words inside display headings switch to an elegant italic serif */
.statement .acc,
.contact-line .acc {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0;
  font-size: 1.08em;
}

/* ---------- Hero ---------- */

.hero {
  min-height: 100dvh;
  max-width: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(2rem, 6vh, 4rem);
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
}

.kinetic {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.k-row {
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3rem, 9.5vw, 8.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  will-change: transform;
}

.k-row span { display: inline-block; }

.k-row.outline {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--accent);
}

.k-row.dim { opacity: 0.22; }

.hero-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.3rem;
  text-align: center;
  padding: 0 var(--pad);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  transition: border-color 250ms ease, color 250ms ease;
}

.chip:hover { border-color: var(--accent); color: var(--fg); }

a.chip {
  text-decoration: none;
  cursor: pointer;
}

.chip-cta {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.chip-cta:hover, .chip-cta:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.scroll-cue { animation: cue 2.4s ease infinite; }

@keyframes cue { 50% { transform: translateY(6px); opacity: 0.4; } }

/* ---------- Panels / grids ---------- */

.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
}

.body-text {
  max-width: 56ch;
  font-size: clamp(1.02rem, 1.4vw, 1.25rem);
}

.body-text p { margin-bottom: 1.4em; }
.body-text p:last-child { margin-bottom: 0; }

.panel {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 80%, transparent);
  padding: 1.4rem;
  margin-bottom: 1.2rem;
}

.panel-title {
  margin-bottom: 1.1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.lang { margin-bottom: 1rem; }
.lang:last-child { margin-bottom: 0; }

.lang-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.lang-bar {
  height: 2px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}

.lang-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s var(--ease) 200ms;
}

.in .lang-fill { transform: scaleX(var(--pct)); }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--line);
}

.kv:last-child { border-bottom: none; }
.kv a { text-decoration: none; }

/* ---------- Timeline ---------- */

.timeline {
  position: relative;
  padding-left: clamp(1.6rem, 4vw, 3rem);
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.timeline::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: var(--draw, 0%);
  width: 1px;
  background: var(--accent);
  transition: height 1.4s var(--ease);
}

.tl-entry {
  position: relative;
  padding: clamp(1.6rem, 4vh, 2.6rem) 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 10rem 1fr auto;
  gap: 1.5rem;
  align-items: baseline;
}

.tl-entry::before {
  content: "";
  position: absolute;
  left: calc(-1 * clamp(1.6rem, 4vw, 3rem) - 3.5px);
  top: 2.4rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.tl-period { color: var(--accent-text); }

.tl-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 2.4vw, 1.7rem);
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.tl-org { color: var(--muted); margin-top: 0.3rem; }

.tl-points {
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 55ch;
}

.tl-points li { padding-left: 1.1rem; position: relative; }

.tl-points li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8em;
}

.tl-kind { color: var(--muted); }

/* ---------- Skills / certs ---------- */

.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.2rem;
}

.skill-card {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 80%, transparent);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 300ms ease, transform 300ms var(--ease);
}

.skill-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.skill-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, color-mix(in srgb, var(--accent) 12%, transparent) 50%, transparent 60%);
  transform: translateX(-110%);
  transition: transform 700ms ease;
  pointer-events: none;
}

.skill-card:hover::after { transform: translateX(110%); }

.skill-index {
  color: var(--muted);
  display: block;
  margin-bottom: 1.6rem;
}

.skill-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.skill-tags span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0.3rem 0.6rem;
}

.certs {
  margin-top: clamp(3rem, 7vh, 5rem);
  border-top: 1px solid var(--line);
}

.cert {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.1rem 0.3rem;
  border-bottom: 1px solid var(--line);
}

.cert-name { font-weight: 600; font-size: 0.98rem; }

.cert-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  color: var(--muted);
}

.cert-badge.pending {
  border-color: var(--accent);
  color: var(--accent-text);
  animation: pulse 2.2s ease infinite;
}

/* ---------- Ops (projects) ---------- */

.ops { border-bottom: 1px solid var(--line); }

.op {
  position: relative;
  display: grid;
  grid-template-columns: 4.5rem 1fr auto 3rem;
  align-items: center;
  gap: 2rem;
  padding: clamp(2rem, 5vh, 3.2rem) 0.5rem;
  border-top: 1px solid var(--line);
  text-decoration: none;
  overflow: hidden;
}

/* accent sweep that rises from the bottom edge on hover */
.op::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 450ms var(--ease);
  z-index: -1;
}

a.op:hover::before, a.op:focus-visible::before {
  transform: scaleY(1);
  transform-origin: top;
}

/* .ops .op beats the [data-reveal] transition override further down */
.ops .op {
  transition: opacity 900ms var(--ease), transform 900ms var(--ease),
    color 300ms ease, border-color 350ms ease;
}

a.op:hover, a.op:focus-visible {
  color: var(--bg);
  border-top-color: var(--accent);
}

a.op:hover .op-no, a.op:hover .op-desc, a.op:hover .op-meta,
a.op:focus-visible .op-no, a.op:focus-visible .op-desc, a.op:focus-visible .op-meta {
  color: var(--bg);
}

.op-no { color: var(--muted); transition: color 300ms ease; }

.op-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 3.8vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  transition: transform 450ms var(--ease);
}

a.op:hover .op-title, a.op:focus-visible .op-title {
  transform: translateX(1.2rem);
}

.op-desc {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 58ch;
  margin-top: 0.55rem;
  transition: color 300ms ease;
}

.op-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  color: var(--muted);
  text-align: right;
  transition: color 300ms ease;
}

.op-arrow { font-size: 1.5rem; transition: transform 450ms var(--ease), color 300ms ease; }

a.op:hover .op-arrow, a.op:focus-visible .op-arrow {
  transform: translate(0.4rem, -0.4rem) rotate(-45deg);
  color: var(--bg);
}

/* ---------- Marquee ---------- */

.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
}

.marquee-inner {
  display: inline-flex;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.95rem, 2.2vw, 1.5rem);
  text-transform: uppercase;
  color: var(--muted);
  animation: marquee 24s linear infinite;
}

.marquee-inner .acc { padding: 0 1.2rem; }

@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Contact ---------- */

.contact-line {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 7.5vw, 6.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
}

.email-link {
  display: inline-block;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.8rem, 5.2vw, 4.2rem);
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--fg);
  text-decoration: none;
  padding-bottom: 0.15em;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0% 2px no-repeat;
  margin-bottom: clamp(3rem, 8vh, 5.5rem);
  transition: color 350ms ease, background-size 500ms var(--ease);
}

.email-link:hover, .email-link:focus-visible {
  color: var(--accent);
  background-size: 100% 2px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 2rem;
}

.footer-group h3 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.footer-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.footer-group a {
  text-decoration: none;
  display: inline-block;
  transition: transform 300ms var(--ease), color 300ms var(--ease);
}

.footer-group a:hover, .footer-group a:focus-visible {
  transform: translateX(6px);
  color: var(--accent);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: clamp(4rem, 9vh, 6.5rem);
  padding-top: 1.4rem;
  padding-bottom: calc(var(--hud-h) + 0.5rem);
  border-top: 1px solid var(--line);
}

.footer-bottom a, .footer-bottom button { text-decoration: none; }
.footer-bottom a:hover, .footer-bottom button:hover { color: var(--accent); }

/* ---------- Reveal ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 900ms var(--ease), transform 900ms var(--ease);
}

[data-reveal].in {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .rail { display: none; }
  .grid-2, .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --hud-h: 3rem; }

  .hide-m { display: none !important; }

  /* top bar: the status line is already shown as a hero chip — drop it here
     so the logo + language switch have room to breathe */
  .hud-status { display: none; }
  .logo { font-size: 1rem; }

  /* bottom bar: hide the chapter label, spread the nav across the full width
     so nothing (cv.pdf especially) gets clipped off the right edge */
  #hud-chapter { display: none; }
  .hud-bottom { justify-content: center; }
  .hud-nav {
    width: 100%;
    gap: 0.2rem;
    justify-content: space-between;
    font-size: 0.6rem;
  }
  .hud-nav a { padding: 1rem 0.1rem; }

  .tl-entry { grid-template-columns: 1fr; gap: 0.4rem; }
  .tl-kind { display: none; }

  /* projects: drop the cramped right column — stack the meta (year/status/
     tech) below the title, full width and readable instead of clipped */
  .op {
    grid-template-columns: 2.4rem 1fr;
    gap: 0.5rem 1rem;
  }
  .op-arrow { display: none; }
  .op-meta {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 0.9rem;
    text-align: left;
    margin-top: 0.5rem;
    color: var(--accent-text);
  }

  .ghost { font-size: clamp(5rem, 26vw, 8rem); }

  /* arsenal skill tags: muted grey is hard to read on a phone → accent */
  .skill-tags span {
    color: var(--accent-text);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  }
  .skill-index { color: var(--accent-text); }
}

/* very narrow phones: drop one nav item so the row never wraps or clips */
@media (max-width: 400px) {
  .hud-nav a:not(.acc):nth-child(2) { display: none; }
}

/* ---------- v4.1 additions ---------- */

#snd-btn, #pal-hint {
  color: var(--muted);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: color 250ms ease;
  padding: 1.15rem 0.35rem;
}

#snd-btn:hover, #pal-hint:hover { color: var(--fg); }

/* cert progress bar */
.cert-progress {
  grid-column: 1 / -1;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}

.cert-progress-fill {
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s var(--ease) 300ms;
}

.cert.in .cert-progress-fill { transform: scaleX(var(--p)); }

/* command palette */
#palette {
  position: fixed;
  inset: 0;
  z-index: 10003;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16vh;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

#palette[hidden] { display: none; }

.pal-win {
  width: min(520px, 92vw);
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

#pal-in {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  outline: none;
  color: var(--fg);
  font: inherit;
  letter-spacing: 0.06em;
  text-transform: none;
  padding: 1rem 1.1rem;
}

#pal-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.4rem;
}

.pal-item {
  display: flex;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.8rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: none;
}

.pal-item.sel {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--fg);
}

.pal-item .k { color: var(--accent-text); }

/* ---------- Print: clean CV-like output ---------- */

@media print {
  .grain, #gl, #loader, #cursor, .hud, .rail, #toast, #terminal, #palette,
  .marquee, .kinetic, .scroll-cue, #term-open, .ghost, #back-top {
    display: none !important;
  }

  * { cursor: auto !important; }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.5;
  }

  #app.smooth {
    position: static;
    transform: none !important;
  }

  #scroll-spacer { display: none; }

  .sr-only {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    white-space: normal;
    font-size: 22pt;
    font-weight: 700;
  }

  .hero { min-height: auto; padding: 0 0 1rem; }
  .chapter { padding: 1.2rem 0; max-width: 100%; }

  [data-reveal], [data-split] .wi {
    opacity: 1 !important;
    transform: none !important;
  }

  .statement, .contact-line, .op-title, .tl-title, .skill-name, .email-link {
    color: #000;
    -webkit-text-stroke: 0;
  }

  .acc, .tl-period, .mono.acc, .mono .acc { color: #c33a00; }
  .muted, .op-desc, .tl-org, .tl-points, .op-meta { color: #444; }

  .panel, .skill-card, .op, .cert, .tl-entry { border-color: #ccc; }
  .timeline::before, .timeline::after { background: #ccc; }
  .lang-fill, .cert-progress-fill { background: #c33a00; transform: scaleX(var(--pct, var(--p, 1))); }

  a { color: #000; text-decoration: none; }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #666;
  }
}

/* ---------- Touch feedback (no hover on these devices) ---------- */

@media (hover: none) {
  a.op:active::before {
    transform: scaleY(1);
    transition-duration: 80ms;
  }

  a.op:active,
  a.op:active .op-no,
  a.op:active .op-desc,
  a.op:active .op-meta {
    color: var(--bg);
  }

  .skill-card:active,
  .chip:active {
    border-color: var(--accent);
  }

  .footer-group a:active,
  .hud-nav a:active {
    color: var(--accent-text);
  }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .grain, .scroll-cue, .marquee-inner, .hud-status::before, .cert-badge.pending {
    animation: none;
  }

  [data-reveal], [data-split] .wi, #loader, .lang-fill, body {
    transition: none;
  }

  [data-reveal] { opacity: 1; transform: none; }
  [data-split] .wi { transform: none; }
  .in .lang-fill, .lang-fill { transform: scaleX(var(--pct)); }
  .timeline::after { height: 100%; transition: none; }
}
