/* ============================================================
   webdevfrancisco.tech — systems-engineer noir
   slate-navy canvas · amber accent · mono details
   ============================================================ */

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("assets/fonts/schibsted-grotesk-var-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
}

:root {
  --bg: #0b1120;
  --bg-raised: rgba(30, 41, 59, 0.5);
  --line: rgba(148, 163, 184, 0.12);
  --text: #9aa8bf;
  --text-dim: #7b89a0; /* AA 4.5:1+ on bg, terminal bg, and card-hover bg */
  --bright: #e6ecf5;
  --accent: #fbbf24;
  --accent-soft: rgba(251, 191, 36, 0.1);
  --accent-line: rgba(251, 191, 36, 0.35);
  --ok: #4ade80;
  --sans: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* faint amber dawn top-left, deep vignette bottom-right — a fixed
   pseudo-element, since background-attachment:fixed is broken on iOS */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 800px at 12% -10%, rgba(251, 191, 36, 0.05), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(30, 58, 138, 0.18), transparent 65%);
}

::selection { background: var(--accent); color: #1c1305; }

/* ---------- atmosphere layers ---------- */

.spotlight {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(600px at var(--mx, 50%) var(--my, 30%), rgba(251, 191, 36, 0.055), transparent 80%);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.spotlight.on { opacity: 1; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- structure ---------- */

.layout {
  position: relative;
  z-index: 3;
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

@media (min-width: 640px) {
  .layout { padding: 4rem 3rem; }
}

@media (min-width: 1024px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 1.5rem;
    padding: 0 3rem;
  }
  .hero {
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6rem 2rem 4rem 0;
  }
  main { padding: 6rem 0 4rem; }
  .layout > footer { grid-column: 2; }
}

/* short two-column viewports: shrink, then release the sticky panel */
@media (min-width: 1024px) and (max-height: 799px) {
  .hero { padding: 3rem 2rem 2.5rem 0; }
  .side-nav { margin-top: 2.25rem; }
}
@media (min-width: 1024px) and (max-height: 679px) {
  .hero { position: static; height: auto; max-height: none; }
}

/* ---------- skip link & focus ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 50;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: #1c1305;
  font-family: var(--mono);
  font-size: 0.8rem;
  border-radius: 0 0 6px 0;
}
.skip-link:focus {
  left: 0;
  top: 0;
}

:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- hero (left panel) ---------- */

.hero-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}
.avatar {
  display: block;
  width: 96px;
  height: 96px;
  max-width: 96px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid var(--accent-line);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.08);
  flex: none;
  overflow: hidden;
  /* iOS Safari: force circular clip on <img> */
  -webkit-mask-image: radial-gradient(circle, #000 99%, transparent 100%);
  mask-image: radial-gradient(circle, #000 99%, transparent 100%);
  clip-path: circle(50% at 50% 50%);
}
@media (min-width: 900px) {
  .avatar {
    width: 104px;
    height: 104px;
    max-width: 104px;
  }
}

.hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--bright);
  margin: 0;
}
.hero h1 a { color: inherit; text-decoration: none; }
.hero h1 a:hover { color: var(--bright); }

.hero h2 {
  margin-top: 0;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--bright);
}

.tagline {
  margin-top: 1rem;
  max-width: 34ch;
  color: var(--text);
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.type-line {
  margin-top: 1.75rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  min-height: 3.3em; /* 2 lines × 1.65 line-height */
  min-height: 2lh;
  text-align: center;
}
.type-line .prompt { color: var(--accent); }
.type-line #typed { color: var(--text); }
.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
.cursor.paused { animation: none; }
@keyframes blink { 50% { opacity: 0; } }

.type-toggle {
  margin-left: 0.6rem;
  padding: 0 0.45rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.type-toggle:hover { color: var(--accent); border-color: var(--accent-line); }

/* side nav — desktop only */
.side-nav { display: none; }
@media (min-width: 1024px) {
  .side-nav { display: block; margin-top: 4rem; }
  .side-nav ul { list-style: none; }
  .side-nav li + li { margin-top: 0.35rem; }
  .nav-link {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.55rem 0;
    text-decoration: none;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-dim);
  }
  .nav-line {
    width: 2rem;
    height: 1px;
    background: var(--text-dim);
    transition: width 0.3s var(--ease), background-color 0.3s;
  }
  .nav-idx { color: var(--accent); opacity: 0.65; font-size: 0.65rem; transition: opacity 0.3s; }
  .nav-link:hover, .nav-link.active {
    color: var(--bright);
  }
  .nav-link:hover .nav-line, .nav-link.active .nav-line {
    width: 4rem;
    background: var(--accent);
  }
  .nav-link:hover .nav-idx, .nav-link.active .nav-idx { opacity: 1; }
}

.social {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  margin-top: 2.5rem;
  align-items: center;
}
.social a {
  display: inline-flex;
  color: var(--text-dim);
  transition: color 0.25s, transform 0.25s var(--ease);
}
.social a:hover { color: var(--accent); transform: translateY(-3px); }
.social svg { width: 1.35rem; height: 1.35rem; }

/* ---------- sections ---------- */

section { padding: 3rem 0; }
section:first-of-type { padding-top: 1rem; }
@media (min-width: 1024px) {
  section { padding: 0 0 7rem; scroll-margin-top: 6rem; }
  section:first-of-type { padding-top: 0; } /* keep About level with the hero h1 */
}
@media (max-width: 1023px) {
  section { scroll-margin-top: 4.5rem; }
}

.section-head {
  margin-bottom: 1.75rem;
}
.section-head h2 {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--bright);
}
.section-head .idx { color: var(--accent); margin-right: 0.35rem; }

/* mobile sticky section headers, Brittany-style */
@media (max-width: 1023px) {
  .section-head {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 -1.5rem 1.5rem;
    padding: 1rem 1.5rem;
    background: rgba(11, 17, 32, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}
/* tablet gutter is 3rem — keep the sticky bar full-bleed there too */
@media (min-width: 640px) and (max-width: 1023px) {
  .section-head {
    margin: 0 -3rem 1.5rem;
    padding: 1rem 3rem;
  }
}

.prose p + p { margin-top: 1.1rem; }
.prose { max-width: 62ch; }
.prose a {
  color: var(--bright);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
  transition: color 0.2s, border-color 0.2s;
}
.prose a:hover { color: var(--accent); border-color: var(--accent); }
.prose em { color: var(--bright); font-style: italic; }
.prose strong { color: var(--bright); }

/* ---------- cards (experience + projects) ---------- */

.card-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  position: relative;
  display: grid;
  gap: 0.6rem 1.5rem;
  padding: 1.25rem 0; /* text stays flush-left with prose; halo bleeds outward */
  border-radius: 8px;
  transition: opacity 0.3s, transform 0.3s var(--ease);
}
@media (min-width: 640px) {
  .card { grid-template-columns: minmax(0, 2fr) minmax(0, 5fr); }
  .card--project { grid-template-columns: minmax(0, 3fr) minmax(0, 5fr); }
}

/* hover halo */
.card::before {
  content: "";
  position: absolute;
  inset: 0 -1.25rem;
  border-radius: 8px;
  background: var(--bg-raised);
  border: 1px solid transparent;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
}
@media (hover: hover) {
  .card:hover::before {
    opacity: 1;
    border-color: var(--line);
    box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(230, 236, 245, 0.04);
  }
  /* dim siblings while one card is hovered (0.75 keeps dimmed text AA-legible) */
  .card-list:hover .card { opacity: 0.75; }
  .card-list:hover .card:hover { opacity: 1; }
}

.dates {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-top: 0.3rem;
  display: block;
}

.card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--bright);
  line-height: 1.35;
}
.card-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
}
.card-body > p { margin-top: 0.6rem; font-size: 0.95rem; }

.card-bullets {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.card-bullets li {
  position: relative;
  padding-left: 1rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}
.card-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
}
.card-bullets li strong {
  color: var(--bright);
  font-weight: 600;
}

.card-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  transition: color 0.2s;
}
.card-link:hover { color: var(--accent); }
.card-link .arrow {
  width: 0.85em;
  height: 0.85em;
  flex: none;
  align-self: center;
  transition: transform 0.25s var(--ease);
}
.card-link:hover .arrow { transform: translate(3px, -3px); }

.pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}
.pills li {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
}

.more-link { margin-top: 1.75rem; }
.more-link .card-link {
  color: var(--bright);
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--accent-line);
  padding-bottom: 2px;
}
.more-link .card-link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- terminal visuals ---------- */

.terminal {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 6, 16, 0.72);
  overflow: hidden;
  font-family: var(--mono);
  transition: border-color 0.3s;
  max-width: 100%;
}
.card:hover .terminal { border-color: var(--accent-line); }
.terminal-bar {
  display: flex;
  gap: 5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.terminal-bar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  opacity: 0.45;
}
.terminal-bar i:first-child { background: var(--accent); opacity: 0.8; }
.terminal-body {
  padding: 0.85rem 0.9rem 0.95rem;
  font-size: 0.7rem;
  line-height: 1.55;
  color: var(--text-dim);
}
.t-line { margin: 0; }
.t-cmd {
  color: var(--bright);
  margin-bottom: 0.65rem;
}
.t-prompt {
  color: var(--accent);
  margin-right: 0.4rem;
}
.t-pillars {
  color: var(--text);
  margin-bottom: 0.7rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  letter-spacing: 0.01em;
}
.t-kv {
  display: grid;
  grid-template-columns: 3.1rem 1fr;
  gap: 0.55rem;
  align-items: baseline;
  margin-top: 0.35rem;
}
.t-k {
  color: var(--accent);
  opacity: 0.85;
  letter-spacing: 0.04em;
}
.t-v { color: var(--text-dim); }
.t-ok { color: var(--ok); }
.terminal pre {
  padding: 0.7rem 0.8rem;
  font-size: 0.68rem;
  line-height: 1.75;
  color: var(--text-dim);
  overflow-x: auto;
}

@media (max-width: 639px) {
  .card-aside { order: -1; }
  .terminal { max-width: 22rem; }
}

/* ---------- architecture stack (THE SYSTEM) ---------- */

.arch { margin-top: 2.75rem; }
.arch-title {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--bright);
  margin-bottom: 0.75rem;
}
.arch ul { list-style: none; }
.arch li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.15rem 0;
}
.arch li + li { border-top: 1px solid var(--line); }
.arch-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.25rem;
}
.arch li p { font-size: 0.95rem; }
.arch strong { color: var(--bright); font-weight: 600; }
@media (max-width: 479px) {
  .arch li { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* ---------- right-column entrance (class applied by JS only) ---------- */

.will-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.will-reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- contact ---------- */

.contact-big {
  font-size: clamp(1.85rem, 6vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--bright);
  margin-top: 0.25rem;
}
.contact-copy {
  margin-top: 0.75rem;
  max-width: 36ch;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.55;
}
.contact-doors {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.75rem;
  text-align: left;
  width: 100%;
  max-width: 44rem;
}
@media (min-width: 720px) {
  .contact-doors {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-inline: auto;
  }
}
.contact-door {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 1.25rem 1.2rem 1.35rem;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color 0.25s, transform 0.25s var(--ease), box-shadow 0.25s;
  min-height: 100%;
}
@media (max-width: 719px) {
  .contact-doors {
    gap: 2.5rem;
  }
  .contact-door {
    padding: 1.35rem 1.2rem 1.6rem;
  }
  .contact-door + .contact-door {
    margin-top: 0.25rem;
  }
  .contact-door .button {
    margin-top: 1.65rem;
    margin-bottom: 0.25rem;
  }
}
.contact-door:hover {
  border-color: var(--accent-line);
  box-shadow: 0 12px 40px -20px rgba(0, 0, 0, 0.65);
  transform: translateY(-2px);
}
.door-label {
  display: block;
  margin: 0 0 0.7rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.contact-door h4 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--bright);
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.contact-door p:not(.door-label) {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}
.contact-door .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.85rem 1.15rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  box-sizing: border-box;
}
@media (min-width: 720px) {
  .contact-door .button {
    width: auto;
    align-self: flex-start;
    border-radius: 999px;
    padding: 0.72rem 1.35rem;
  }
}
.contact-door .button:hover {
  background: var(--accent-soft);
}
/* the closing section reads as a centered finale on larger screens */
@media (min-width: 640px) {
  .contact { text-align: center; }
  .contact-copy { margin-inline: auto; }
  .contact-doors { text-align: left; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .contact .section-head { text-align: left; }
}
@media (min-width: 1024px) {
  .contact { padding-top: 3rem; }
}
.button {
  display: inline-block;
  margin-top: 2rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 2rem;
  transition: background-color 0.25s, box-shadow 0.25s, transform 0.25s var(--ease), border-color 0.25s, color 0.25s;
}
.button:hover {
  background: var(--accent-soft);
  box-shadow: 0 0 24px -6px rgba(251, 191, 36, 0.35);
  transform: translateY(-2px);
}

/* ---------- footer ---------- */

footer {
  padding: 2rem 0 3rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  max-width: 56ch;
}
footer a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: color 0.2s;
}
footer a:hover { color: var(--accent); }

/* ---------- load reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.7s var(--ease) forwards;
}
.r1 { animation-delay: 0.05s; }
.r2 { animation-delay: 0.14s; }
.r3 { animation-delay: 0.23s; }
.r4 { animation-delay: 0.32s; }
.r5 { animation-delay: 0.45s; }
.r6 { animation-delay: 0.58s; }
@keyframes rise {
  to { opacity: 1; transform: none; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none; opacity: 1; transform: none; }
  .will-reveal { opacity: 1; transform: none; transition: none; }
  .cursor { animation: none; }
  .spotlight { display: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
