/* ============================================
   MAX. PORTFOLIO — Brutalist / Technical
   ============================================ */

/* ===== PAGE LOADER ===== */
#loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1), visibility 0.7s;
}
#loader.ld-out { opacity: 0; visibility: hidden; pointer-events: none; }
.ld-scan {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg,transparent,transparent 3px,rgba(0,0,0,0.14) 3px,rgba(0,0,0,0.14) 4px);
  pointer-events: none;
}
.ld-frame { position: absolute; inset: 20px; border: 1px solid #2a2a2a; pointer-events: none; }
.ld-fc { position: absolute; width: 18px; height: 18px; border-color: #ff5a1f; border-style: solid; }
.ld-fc.tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.ld-fc.tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.ld-fc.bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.ld-fc.br { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }
.ld-tag {
  position: absolute; top: 32px; left: 32px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.18em; color: #5a5650;
}
.ld-rec {
  position: absolute; bottom: 32px; left: 32px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.16em; color: #ff5a1f;
  display: flex; align-items: center; gap: 6px;
}
.ld-rec-dot { width: 6px; height: 6px; background: #ff5a1f; border-radius: 50%; animation: ld-blink 0.9s steps(1) infinite; }
.ld-frame-lbl {
  position: absolute; bottom: 32px; right: 32px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.16em; color: #5a5650;
}
.ld-center { display: flex; flex-direction: column; align-items: center; gap: 24px; user-select: none; }
.ld-logo {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(80px, 14vw, 160px);
  letter-spacing: -0.04em;
  color: #f5f1e8;
  line-height: 1;
  animation: ld-up 0.5s cubic-bezier(0.2,0,0,1) both;
}
.ld-logo-dot { color: #ff5a1f; }
.ld-bar-wrap { width: min(280px, 60vw); height: 1px; background: #2a2a2a; overflow: hidden; }
.ld-bar-fill { height: 1px; background: #ff5a1f; width: 0; animation: ld-fill 1.6s cubic-bezier(0.4,0,0.2,1) 0.1s forwards; }
.ld-counter {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; letter-spacing: 0.18em; color: #5a5650;
  display: flex; align-items: center; gap: 6px;
}
.ld-pct { color: #f5f1e8; }
@keyframes ld-fill { to { width: 100%; } }
@keyframes ld-blink { 50% { opacity: 0; } }
@keyframes ld-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

:root {
  --bg: #0a0a0a;
  --bg-1: #111111;
  --bg-2: #1a1a1a;
  --line: #2a2a2a;
  --line-strong: #444444;
  --fg: #f5f1e8;
  --fg-dim: #8a8680;
  --fg-mute: #5a5650;
  --accent: #ff5a1f;
  --accent-dim: #d94a18;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  cursor: none;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; color: inherit; cursor: none; }
img, video { display: block; max-width: 100%; }

/* ===== Custom cursor ===== */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 10000;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
.cursor-ring {
  width: 32px; height: 32px;
  border: 1px solid var(--fg);
  border-radius: 50%;
  transition: transform 0.18s ease, width 0.2s, height 0.2s, border-color 0.2s;
}
.cursor-ring.hover {
  width: 64px; height: 64px;
  border-color: var(--accent);
  background: rgba(255, 90, 31, 0.06);
}
.cursor-ring.text {
  width: 4px; height: 22px;
  border-radius: 0;
  border: none;
  background: var(--accent);
}

@media (hover: none) {
  html, body, a, button { cursor: auto; }
  .cursor-dot, .cursor-ring { display: none; }
}

/* ===== Layout ===== */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.frame-border {
  position: fixed;
  inset: 12px;
  border: 1px solid var(--line);
  pointer-events: none;
  z-index: 50;
}
.frame-border::before,
.frame-border::after {
  content: '';
  position: absolute;
  background: var(--accent);
}
.frame-border::before {
  top: -3px; left: -3px;
  width: 12px; height: 12px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
  background: transparent;
}
.frame-border::after {
  bottom: -3px; right: -3px;
  width: 12px; height: 12px;
  border-bottom: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  background: transparent;
}

/* ===== Top bar ===== */
.topbar {
  position: fixed;
  top: 12px; left: 12px; right: 12px;
  height: 56px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  background: rgba(10,10,10,0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar-left { display: flex; align-items: center; gap: 16px; color: var(--fg-dim); }
.topbar-logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-transform: none;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.topbar-logo .dot { color: var(--accent); }
.topbar-nav {
  display: flex;
  gap: 4px;
  border: 1px solid var(--line);
  padding: 4px;
}
.topbar-nav a {
  padding: 6px 14px;
  color: var(--fg-dim);
  transition: all 0.15s;
  position: relative;
}
.topbar-nav a:hover { color: var(--fg); }
.topbar-nav a.active {
  color: var(--bg);
  background: var(--accent);
}
.topbar-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  color: var(--fg-dim);
}
.topbar-right .live-dot {
  width: 6px; height: 6px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #4ade80;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== Page ===== */
.page {
  flex: 1;
  padding-top: 80px;
  padding-bottom: 60px;
}
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ===== Section headers ===== */
.section-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-tag::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--accent);
}
.section-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

/* ===== Bottom bar ===== */
.botbar {
  position: fixed;
  bottom: 12px; left: 12px; right: 12px;
  height: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 0 24px;
  background: rgba(10,10,10,0.7);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 100;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.botbar > div:nth-child(2) { text-align: center; }
.botbar > div:nth-child(3) { text-align: right; }
.botbar .clock { color: var(--fg-dim); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--bg);
  color: var(--accent);
}
.btn .arrow {
  display: inline-block;
  transition: transform 0.2s;
}
.btn:hover .arrow { transform: translateX(4px); }

/* ===== CV Download button ===== */
.cv-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  transition: background 0.2s, color 0.2s;
}
.cv-dl-btn:hover {
  background: var(--accent);
  color: var(--bg);
}
.cv-dl-btn-lg {
  border-color: var(--fg-mute);
  color: var(--fg-dim);
}
.cv-dl-btn-lg:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.corner-cv {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.corner-cv:hover { color: var(--accent); }

/* ===== Crosshair pattern ===== */
.crosshair {
  position: absolute;
  width: 16px; height: 16px;
}
.crosshair::before,
.crosshair::after {
  content: '';
  position: absolute;
  background: var(--accent);
}
.crosshair::before {
  top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-50%);
}
.crosshair::after {
  left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-50%);
}

/* ===== Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2,.8,.2,1);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== Selection ===== */
::selection { background: var(--accent); color: var(--bg); }

/* ===== Utility ===== */
.mono { font-family: var(--mono); }
.display { font-family: var(--display); }
.dim { color: var(--fg-dim); }
.mute { color: var(--fg-mute); }
.acc { color: var(--accent); }
.upper { text-transform: uppercase; letter-spacing: 0.1em; }

/* ============================================
   RESPONSIVE — Tablet & Mobile
   ============================================ */

/* Tablet (≤1024px) */
@media (max-width: 1024px) {
  .container { padding: 0 20px; }
  .frame-border { inset: 8px; }
  .topbar { left: 8px; right: 8px; padding: 0 16px; }
  .botbar { left: 8px; right: 8px; padding: 0 14px; }
  .topbar-left .dim { display: none !important; }
}

/* Mobile (≤768px) */
@media (max-width: 768px) {
  html, body { font-size: 13px; }
  .container { padding: 0 16px; }
  .frame-border { inset: 6px; }

  /* Topbar — compact for mobile */
  .topbar {
    top: 6px; left: 6px; right: 6px;
    height: 48px;
    padding: 0 10px;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
  }
  .topbar-left { gap: 8px; }
  .topbar-logo { font-size: 16px; }
  .topbar-nav {
    justify-self: end;
    gap: 0;
    padding: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topbar-nav a {
    padding: 5px 8px;
    font-size: 10px;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }
  .topbar-right { gap: 8px; font-size: 10px; }
  .topbar-right > span:nth-child(2) { display: none; } /* v.04·26 */
  .topbar-right > span:first-child .live-dot + * { display: none; }
  .cv-dl-btn { padding: 4px 8px; font-size: 9px; gap: 4px; }

  /* Botbar — only show section label + clock */
  .botbar {
    bottom: 6px; left: 6px; right: 6px;
    height: 28px;
    padding: 0 12px;
    grid-template-columns: 1fr 1fr;
    font-size: 9px;
    letter-spacing: 0.06em;
  }
  .botbar > div:first-child { display: none; }
  .botbar > div:nth-child(2) { text-align: left; }
  .botbar > div:nth-child(3) { text-align: right; }

  .page { padding-top: 64px; padding-bottom: 44px; }

  .btn { padding: 12px 18px; font-size: 10px; gap: 8px; }

  /* Native cursor on touch */
  html, body, a, button { cursor: auto; }
  .cursor-dot, .cursor-ring { display: none; }

  /* Hide dev tweaks panel on mobile */
  .twk-panel { display: none !important; }

  /* Compact loader on mobile */
  .ld-tag { top: 20px; left: 20px; font-size: 9px; }
  .ld-rec { bottom: 20px; left: 20px; font-size: 9px; }
  .ld-frame-lbl { bottom: 20px; right: 20px; font-size: 9px; }
  .ld-frame { inset: 12px; }
}

/* Small mobile (≤480px) */
@media (max-width: 480px) {
  .topbar-right > span:first-child { font-size: 0; }
  .topbar-right > span:first-child .live-dot { margin-right: 0; }
  .topbar-nav a { padding: 5px 6px; }
  .topbar-logo { font-size: 15px; }
}
