/* ================================================================
   Samuel Blanco — portfolio
   Single-page brand surface. OKLCH tokens, fluid type, Manrope +
   JetBrains Mono. Restraint as voice; one teal carries the mood.
   ================================================================ */

/* Fonts loaded via <link> in index.html for parallel fetch. */

/* ---- Tokens ----------------------------------------------------- */

:root {
  /* Color — committed teal on pure white, one warm copper for signal. */
  --bg:             oklch(1.000 0     0);
  --ink:            oklch(0.14  0.010 188);
  --ink-soft:       oklch(0.30  0.012 188);
  --muted:          oklch(0.46  0.012 188);
  --line:           oklch(0.92  0.006 188);
  --line-strong:    oklch(0.82  0.008 188);
  --primary:        oklch(0.50  0.115 188);
  --primary-hover:  oklch(0.42  0.118 188);
  --accent:         oklch(0.62  0.140 50);
  --accent-soft:    oklch(0.96  0.020 50);

  /* Type */
  --font-sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Fluid scale */
  --step--1: clamp(0.75rem, 0.72rem + 0.12vw, 0.8rem);
  --step-0:  clamp(0.875rem, 0.84rem + 0.18vw, 0.95rem);
  --step-1:  clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
  --step-2:  clamp(1.125rem, 1.05rem + 0.4vw, 1.25rem);
  --step-3:  clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-4:  clamp(2rem, 1.6rem + 2vw, 2.875rem);
  --display: clamp(2.25rem, 1.55rem + 3.4vw, 4.25rem);

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radii + z */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-full: 999px;
  --z-sticky: 10;

  /* Motion */
  --ease-out:        cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-strong: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Reset ------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  font-family: var(--font-sans);
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern', 'liga';
}
img, svg, picture, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { background: none; border: 0; cursor: pointer; color: inherit; font: inherit; }
ul, ol { list-style: none; }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 2px;
}
::selection { background: var(--primary); color: var(--bg); }

/* Skip-link: invisible until keyboard-focused. */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(-150%);
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: calc(var(--z-sticky) + 1);
  transition: transform 180ms var(--ease-out);
}
.skip-link:focus-visible {
  transform: translateY(0);
}

/* ---- Layout primitives ------------------------------------------ */

.shell {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

/* Top hairline — calibration mark. Cosmetic; doesn't carry meaning. */
.eyeline {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--primary);
  opacity: 0.55;
  z-index: var(--z-sticky);
  pointer-events: none;
}

/* ---- Topbar ----------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: clamp(1.25rem, 3vw, 1.75rem);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  color: var(--muted);
}
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  color: var(--ink);
  font-weight: 500;
}
.topbar__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.topbar__url { font-variant-numeric: tabular-nums; }

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 30%, 320px);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: end;
  padding-block: clamp(3.5rem, 9vw, 7.5rem) clamp(4rem, 10vw, 8.5rem);
}
@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    padding-block: clamp(2.5rem, 6vw, 4rem) clamp(3rem, 7vw, 5rem);
  }
}

.hero__text { width: 100%; }

.hero__title {
  font-size: var(--display);
  line-height: 1.02;
  letter-spacing: -0.028em;
  font-weight: 500;
  color: var(--ink);
  text-wrap: balance;
  max-width: 18ch;
  margin-bottom: var(--space-6);
}
.hero__title em {
  font-style: normal;
  color: var(--primary);
}

.hero__lede {
  font-size: var(--step-2);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 30ch;
  text-wrap: pretty;
  margin-bottom: var(--space-8);
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.hero__portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  width: 100%;
  max-width: 320px;
  justify-self: end;
  align-self: end;
}
@media (max-width: 720px) {
  .hero__portrait {
    max-width: 240px;
    justify-self: start;
    margin-top: var(--space-6);
  }
}
.hero__portrait img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 4px;
  filter: saturate(0.92) contrast(1.02);
}
.hero__portrait::after {
  /* Registration-mark frame: offset up-right, like a print artifact. */
  content: "";
  position: absolute;
  top: -10px;
  right: -10px;
  bottom: 10px;
  left: 10px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

/* ---- Buttons ---------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.72em 1.2em;
  font-size: var(--step-1);
  font-weight: 500;
  border-radius: var(--radius-full);
  transition:
    background 200ms var(--ease-out),
    color 200ms var(--ease-out),
    border-color 200ms var(--ease-out),
    transform 200ms var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn__icon { width: 1em; height: 1em; flex-shrink: 0; }

.btn--primary {
  background: var(--primary);
  color: var(--bg);
}
.btn--primary:hover { background: var(--primary-hover); }

.btn--ghost {
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
}
.btn--ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ---- Section frame --------------------------------------------- */

.section {
  padding-block: clamp(3.5rem, 7vw, 6rem);
  border-top: 1px solid var(--line);
}
.section__title {
  font-size: var(--step-3);
  font-weight: 500;
  letter-spacing: -0.022em;
  color: var(--ink);
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
}

/* ---- Stack ------------------------------------------------------ */

.stack {
  display: grid;
  gap: 0;
}
.stack__row {
  display: grid;
  grid-template-columns: minmax(110px, 13%) 1fr;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding-block: clamp(1rem, 2vw, 1.5rem);
  border-bottom: 1px solid var(--line);
}
.stack__row:last-child { border-bottom: 0; }
@media (max-width: 600px) {
  .stack__row {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding-block: 1.25rem;
  }
}

.stack__label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.45em;
}

.stack__items {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.875rem, 2.2vw, 1.75rem);
  align-items: center;
}

.stack__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: var(--step-1);
  transition: color 200ms var(--ease-out);
}
.stack__item:hover { color: var(--ink); }
.stack__item img,
.stack__item iconify-icon {
  width: 18px;
  height: 18px;
  font-size: 18px;
  object-fit: contain;
  filter: grayscale(1) contrast(0.9);
  opacity: 0.68;
  transition: filter 250ms var(--ease-out), opacity 250ms var(--ease-out);
}
.stack__item:hover img,
.stack__item:hover iconify-icon {
  filter: grayscale(0) contrast(1);
  opacity: 1;
}
.stack__item iconify-icon {
  display: inline-block;
  flex-shrink: 0;
  color: var(--ink-soft);
}

/* ---- Experience ------------------------------------------------- */

.experience {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: clamp(1.75rem, 4vw, 3rem);
  align-items: center;
}

/* At mobile (2-col layout), if the last item is alone on its row,
   span both columns so it reads as a closing note rather than an orphan. */
@media (max-width: 600px) {
  .experience__item:nth-last-child(1):nth-child(odd) {
    grid-column: 1 / -1;
  }
}
.experience__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
  padding: var(--space-4) 0;
  transition: transform 280ms var(--ease-out);
}
.experience__item:hover { transform: translateY(-2px); }
.experience__logo {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: grayscale(1) contrast(0.92);
  opacity: 0.72;
  transition: filter 280ms var(--ease-out), opacity 280ms var(--ease-out);
}
.experience__item:hover .experience__logo {
  filter: grayscale(0) contrast(1);
  opacity: 1;
}
.experience__logo img {
  max-height: 100%;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}
.experience__name {
  font-weight: 500;
  font-size: var(--step-0);
  color: var(--ink-soft);
  letter-spacing: -0.005em;
  transition: color 280ms var(--ease-out);
}
.experience__item:hover .experience__name { color: var(--ink); }

.experience__detail {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: calc(var(--space-1) * -1);
}

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

.outro {
  padding-block: clamp(4rem, 9vw, 7rem);
  border-top: 1px solid var(--line);
}
.outro__email {
  font-size: clamp(1.4rem, 0.95rem + 2.4vw, 2.625rem);
  font-weight: 500;
  color: var(--primary);
  letter-spacing: -0.022em;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in oklch, var(--primary) 35%, transparent);
  transition: text-decoration-color 220ms var(--ease-out), color 220ms var(--ease-out);
  display: inline-block;
  margin-bottom: var(--space-12);
  max-width: 100%;
}
.outro__email:hover {
  text-decoration-color: var(--primary);
  color: var(--primary-hover);
}

.outro__links {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  flex-wrap: wrap;
  padding-top: var(--space-6);
  border-top: 1px solid var(--line);
}
.outro__link {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-size: var(--step-0);
  color: var(--ink-soft);
  font-weight: 500;
  min-height: 44px;
  padding-block: var(--space-2);
  transition: color 200ms var(--ease-out);
}
.outro__link:hover { color: var(--primary); }
.outro__link svg { width: 1em; height: 1em; flex-shrink: 0; }
.outro__link::after {
  content: "→";
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--muted);
  transition: transform 200ms var(--ease-out), color 200ms var(--ease-out);
}
.outro__link:hover::after {
  transform: translateX(2px);
  color: var(--primary);
}

/* ---- Colophon --------------------------------------------------- */

.colophon {
  padding-block: clamp(1.5rem, 3vw, 2rem) clamp(2.5rem, 5vw, 3.5rem);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.colophon__mark { color: var(--accent); margin-right: 0.4em; }

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

/* Single signature motion: a quiet pulse on the topbar dot.
   Decorative; gates no content. Static fallback for reduced-motion. */

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px var(--accent-soft);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 5px color-mix(in oklch, var(--accent-soft) 80%, transparent);
    transform: scale(1.05);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .topbar__dot {
    animation: pulse 2800ms ease-in-out infinite;
  }
}
