/* Alex Baró — personal site v4 */

/* JetBrains Mono, self-hosted (SIL OFL 1.1, see assets/fonts/OFL-JetBrainsMono.txt) */
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400;font-display:swap;src:url('/assets/fonts/jetbrains-mono-400.woff2') format('woff2')}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:500;font-display:swap;src:url('/assets/fonts/jetbrains-mono-500.woff2') format('woff2')}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:700;font-display:swap;src:url('/assets/fonts/jetbrains-mono-700.woff2') format('woff2')}

:root {
  --bg: #F5F5F4;
  --fg: #0A0A0A;
  --muted: #3F3F46;        /* hero text */
  --muted-lo: #52525B;     /* experience / contact text */
  --ink: #0A0A0A;          /* binary pattern */
  --line: rgba(10, 10, 10, 0.14);
  --accent: #5209d0;       /* purple */
  --accent-2: #22D3EE;     /* teal */
  --link: var(--accent);
  --accent-ink: #FFFFFF;
  --glow: #5209d0;         /* binary glow under the cursor */
  --blob-a-op: 0.34;
  --blob-b-op: 0.3;
  --scroll-a-op: 0.23;
  --scroll-b-op: 0.23;
  --btn-bg: rgba(255, 255, 255, 0.6);
  --btn-border: rgba(10, 10, 10, 0.15);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #0B0D12;
  --fg: #F5F5F4;
  --muted: #A1A1AA;
  --muted-lo: #A1A1AA;
  --ink: #FFFFFF;
  --line: rgba(255, 255, 255, 0.16);
  --link: var(--accent-2);
  --accent-ink: #0B0D12;
  --glow: rgb(160, 120, 229);
  --blob-a-op: 0.41;
  --blob-b-op: 0.34;
  --scroll-a-op: 0.34;
  --scroll-b-op: 0.26;
  --btn-bg: rgba(255, 255, 255, 0.06);
  --btn-border: rgba(255, 255, 255, 0.2);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* ───────────── Binary pattern ───────────── */

.binary {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  font-size: 9px;
  line-height: 17px;
  letter-spacing: 0.35em;
  white-space: nowrap;
  color: var(--ink);
  opacity: 0.05;
}

.binary--glow {
  color: var(--glow);
  opacity: 0.25;
  -webkit-mask-image: radial-gradient(260px circle at var(--mx, 65%) var(--my, 40%), #000 0%, transparent 100%);
          mask-image: radial-gradient(260px circle at var(--mx, 65%) var(--my, 40%), #000 0%, transparent 100%);
}

/* ───────────── Hero ───────────── */

.hero {
  position: relative;
  overflow: hidden;
  min-height: clamp(720px, 100vh, 960px);
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition-property: left, top;
  transition-timing-function: cubic-bezier(.2, .7, .2, 1);
}

.aurora--a {
  width: 640px; height: 640px;
  background: var(--accent);
  opacity: var(--blob-a-op);
  left: 65%; top: 40%;
  transition-duration: 2.5s;
}

.aurora--b {
  width: 520px; height: 520px;
  background: var(--accent-2);
  opacity: var(--blob-b-op);
  left: 54.5%; top: 72%;
  transition-duration: 4s;
}

.hero-fade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 280px;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 100%);
  pointer-events: none;
}

.theme-toggle {
  position: absolute;
  top: 24px; right: 24px;
  z-index: 2;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--fg);
  font: 13px var(--mono);
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.theme-toggle .dim { opacity: 0.6; }
.theme-toggle .next { font-weight: 500; }
.theme-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.hero-inner {
  position: relative;
  min-height: clamp(720px, 100vh, 960px);
  max-width: 1200px;
  margin: 0 auto;
  padding: 96px 40px;
  display: flex;
  flex-wrap: wrap-reverse;
  align-items: start; /* top-align the wordmark and portrait frames (start, not flex-start, because wrap-reverse flips flex-start) */
  justify-content: center;
  align-content: center;
  gap: 40px;
}

.hero-text {
  flex: 1 1 480px;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ───────────── Spec frames ───────────── */

.spec {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.spec-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.spec-box {
  border: 1px dashed var(--muted);
  padding: 26px 30px;
}

.wordmark { margin: 0; line-height: 0; color: var(--fg); }
.wordmark svg { display: block; width: 100%; height: auto; }

.about {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  text-align: justify;
  -webkit-hyphens: auto;
          hyphens: auto;
  color: var(--muted);
}
.about strong { color: var(--fg); font-weight: 500; }
.about .link { text-underline-offset: 3px; }

.portrait-spec { flex: 0 0 auto; }
.photo-box { padding: 22px; line-height: 0; }

.portrait {
  display: block;
  width: 300px;
  max-width: 70vw;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 24px;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  transition: filter 0.7s ease;
}
.photo-box:hover .portrait { filter: grayscale(0) contrast(1); }
@media (hover: none) { .portrait { filter: none; } }

/* ───────────── Below the hero ───────────── */

.lower { position: relative; overflow: clip; }  /* clip (not hidden): the decorative blobs poke 180px past the bottom edge, and overflow:hidden lets that become an invisible, programmatically-scrollable gap that a same-page jump link can land in, leaving blank space below the footer. overflow:clip disallows scrolling into that gap entirely. */

.scroll-blobs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 100%);
}

.scroll-blob {
  position: absolute;
  left: 0;
  border-radius: 50%;
  filter: blur(110px);
  will-change: transform;
}
.scroll-blob--a {
  bottom: -180px;
  width: 400px; height: 400px;
  margin-left: -200px;
  background: var(--accent);
  opacity: var(--scroll-a-op);
  transition: transform 0.6s cubic-bezier(.2, .7, .2, 1);
}
.scroll-blob--b {
  bottom: -160px;
  width: 360px; height: 360px;
  margin-left: -180px;
  background: var(--accent-2);
  opacity: var(--scroll-b-op);
  transition: transform 0.8s cubic-bezier(.2, .7, .2, 1);
}

.section {
  position: relative;
  max-width: 1126px;
  margin: 0 auto;
  padding: 0 40px;
}
.section--experience { padding-top: 48px; padding-bottom: 56px; }
.section--contact { padding-bottom: 72px; }

.section .spec { color: var(--muted-lo); }
.section .spec-box { border-color: var(--muted-lo); padding: 32px 40px; color: var(--fg); }

/* Changelog */

.role {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px;
  padding: 28px 0;
  border-top: 1px dashed var(--line);
  font-size: 14px;
}
.role:first-child { border-top: 0; padding-top: 0; }
.role:last-child { padding-bottom: 0; }

.role-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--muted-lo);
}
.role-meta .years { font-size: 13px; }
.meta-row { display: contents; }

.ver {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted-lo);
  font-size: 12px;
  font-weight: 700;
}
.ver--current {
  background: var(--link);
  border-color: var(--link);
  color: var(--accent-ink);
}

.role-body { display: flex; flex-direction: column; gap: 12px; }

.role-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.role-title .at { color: var(--muted-lo); font-weight: 400; }

.notes {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted-lo);
  line-height: 1.6;
}
.notes li { display: flex; gap: 12px; }
.notes li::before { content: '+'; color: var(--link); font-weight: 700; }

/* Contact */

.status { display: inline-flex; align-items: center; gap: 8px; }
.cup { overflow: visible; filter: drop-shadow(0 0 3px var(--cup-glow)); }
.status[data-state="on"]  { --cup: #22C55E; --cup-glow: rgba(34, 197, 94, 0.6); }
.status[data-state="off"] { --cup: #EF4444; --cup-glow: rgba(239, 68, 68, 0.6); }
.cup path { stroke: var(--cup); }
.cup .cup-body { fill: var(--cup); }

@keyframes steam {
  0%   { opacity: 0; transform: translateY(2px); }
  40%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-3px); }
}
.steam { animation: steam 2s ease-in-out infinite; }

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 16px;
  line-height: 1.6;
}
.contact-list p { margin: 0; }
.contact-list .prompt { color: var(--muted-lo); }
.contact-list a { word-break: normal; overflow-wrap: anywhere; }

.footer {
  position: relative;
  max-width: 1126px;
  margin: 0 auto;
  padding: 0 40px 48px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted-lo);
}

/* ───────────── Hero actions (contact shortcut + theme) ───────────── */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.hero-actions {
  position: absolute;
  top: 24px; right: 24px;
  z-index: 2;
  display: flex;
  gap: 8px;
}
.hero-actions .theme-toggle { position: static; }

.contact-jump {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--fg);
  font: 500 13px var(--mono);
  text-decoration: none;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.contact-jump .dim { opacity: 0.6; font-weight: 400; white-space: pre; }
.contact-jump:hover { border-color: var(--link); }
.contact-jump:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

@media (max-width: 720px) {
  .hero-actions { top: 16px; left: 20px; right: 20px; justify-content: space-between; }
}

/* ───────────── Tablets (721–1023px) ─────────────
   Wordmark and portrait share the first row at equal height;
   about.txt spans the full width underneath. */

@media (min-width: 721px) and (max-width: 1023px) {
  body:not(.error-page) .hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "wordmark portrait" "about about";
    align-content: center;
    align-items: stretch;
    gap: 28px 24px;
    max-width: none;
  }
  body:not(.error-page) .hero-text { display: contents; }
  /* hero hugs its content so experience.log isn't pushed below the fold */
  body:not(.error-page) .hero,
  body:not(.error-page) .hero-inner { min-height: 0; }
  body:not(.error-page) .hero-inner { padding: 112px 40px 120px; }
  .hero-text > .spec:first-child { grid-area: wordmark; }
  .hero-text > .spec:last-child { grid-area: about; }
  .portrait-spec { grid-area: portrait; }

  /* stretch both frames to the same height, contents centred */
  .hero-text > .spec:first-child .spec-box,
  .portrait-spec .photo-box { flex: 1; display: flex; align-items: center; justify-content: center; }
  .hero-text > .spec:first-child .spec-box { padding: 20px 24px; }
  .wordmark { width: 100%; }

  .photo-box { padding: 16px; }
  .portrait { width: clamp(150px, 22vw, 210px); border-radius: 18px; }
}

/* ───────────── Small screens ───────────── */

@media (max-width: 720px) {
  .hero-inner { padding: 96px 20px 64px; }
  .section, .footer { padding-left: 20px; padding-right: 20px; }
  .spec-box { padding: 20px; }
  .section .spec-box { padding: 24px 16px; }
  .role { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .role-meta { gap: 6px; }
  .meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; align-self: stretch; width: 100%; }
  .meta-row .sector { margin-left: auto; font-size: 11px; }
  .meta-row:first-child { gap: 6px; }
  .role-meta .years { font-size: 11px; }
  .role-meta .ver { padding: 2px 8px; font-size: 11px; }
  .role-title { font-size: 17px; }
  .contact-list { font-size: 13px; }
  .about { text-align: left; -webkit-hyphens: manual; hyphens: manual; }
}

/* ───────────── Reduced motion ───────────── */

@media (prefers-reduced-motion: reduce) {
  .aurora, .scroll-blob, .portrait, body { transition: none !important; }
  .steam { animation: none !important; }
}

/* ───────────── Error pages (404 / 403) ───────────── */

.error-page .hero-inner { flex-direction: column; flex-wrap: nowrap; }

.error-card { width: 100%; max-width: 660px; }

.error-code {
  margin: 0;
  font-size: clamp(72px, 14vw, 128px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: var(--fg);
}

.error-lines {
  margin: 24px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  word-break: break-word;
}
.error-lines p { margin: 0; }
.error-lines .prompt { color: var(--muted); }
.error-lines .out { color: var(--fg); }
.error-lines .err { color: #EF4444; }
[data-theme="dark"] .error-lines .err { color: #F87171; }

.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--link);
  animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }
