/*
 * styles.css — portfolio-2026 v2
 *
 * Single-column scroll page. One body face ("Family" Light, self-hosted),
 * one UI face (Google Sans Flex), uniform 32px body, full-bleed dividers,
 * inline colored "tag" highlights with optional lock icons for the
 * project keywords. All values pulled from Figma Dev Mode (node 35:1139).
 */

/* ---------- Self-hosted serif (Klim "Family") ---------- */

@font-face {
  font-family: "Family";
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  src: url("assets/fonts/family-light.woff2") format("woff2");
}

@font-face {
  font-family: "Family";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("assets/fonts/family-regular.woff2") format("woff2");
}

:root {
  /* Surfaces */
  --color-bg: #181818;

  /* Text */
  --color-text: #ffffff;

  /* Dividers — full-bleed white hairlines at 10% opacity (Figma stroke value) */
  --color-divider: rgba(255, 255, 255, 0.1);

  /* Inline-tag accents (per project) */
  --color-tag-blue: #003fb4;
  --color-tag-olive: #a19900;
  --color-tag-red: rgba(255, 45, 45, 0.78);

  /* Type */
  --font-serif: "Family", "Iowan Old Style", "Palatino Linotype",
    Palatino, Georgia, serif;
  --font-sans: "Google Sans Flex", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Inter, Helvetica, Arial, sans-serif;

  /* Body type — uniform 32px Light */
  --font-body-size: 32px;
  --font-body-weight: 300;

  /* Button type */
  --font-button-size: 16px;
  --font-button-letter-spacing: 0.32px;

  /* Rhythm: 120px on every side of every divider */
  --rhythm: 120px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-weight: var(--font-body-weight);
  font-size: var(--font-body-size);
  line-height: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

/* ---------- Page shell ---------- */

.home {
  width: 100%;
  /* No horizontal padding on .home so dividers go full bleed.
     Inner content is centered via section/links rules below. */
}

/* ---------- Brand ("Ted") ---------- */

.home__brand {
  padding-top: var(--rhythm);
  padding-bottom: var(--rhythm);
  display: flex;
  justify-content: center;
}

.home__brand-text {
  /* Symmetric 8px padding (overrides Figma's 14px bottom — user preference) */
  padding: 8px;
  font-family: var(--font-sans);
  font-weight: var(--font-body-weight);
  font-size: 25px;
  line-height: normal;
  color: var(--color-text);
  /* Cap-height to alphabetic baseline trim (CSS Text 4) — Chrome 133+,
     Safari 18.2+. Falls back to normal line-box on Firefox. */
  text-box-edge: cap alphabetic;
  text-box-trim: trim-both;
}

/* Scroll-hint arrow under the brand — hidden for now */
.home__scroll-hint {
  display: none;
  margin-top: 90px;
  justify-content: center;
  color: var(--color-text);
}

.home__scroll-hint svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* ---------- Section pattern ---------- */

.section {
  /* 120 top + 120 bottom — with hr at 0 height between sections
     this yields the required 240px between adjacent text blocks. */
  padding: var(--rhythm) 24px;
  display: flex;
  justify-content: center;
}

/* Scroll-in animation. Initial state hidden; .is-revealed flips it on
   once the element crosses the viewport threshold (see inline JS).
   Applied at the text level (not the section container) so the padded
   layout stays rigid — only the meaningful content moves. */
.section__text,
.home__links {
  opacity: 0;
  transform: translateY(4px) scale(0.95);
  transition:
    opacity 2000ms cubic-bezier(0.1, 0.9, 0.4, 1),
    transform 2000ms cubic-bezier(0.1, 0.9, 0.4, 1);
  will-change: opacity, transform;
}

.section__text.is-revealed,
.home__links.is-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Skip the animation for elements that were already in view at page load —
   they snap to the revealed state instead of fading in. */
.no-transition {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .section__text,
  .home__links {
    transform: none;
    transition: opacity 250ms ease;
  }
  .section__text.is-revealed,
  .home__links.is-revealed {
    transform: none;
  }
}

/* First section's top spacing is owned by the header's padding-bottom */
.section:first-of-type {
  padding-top: 0;
}

.section__text {
  max-width: 563px;
  margin: 0;
  text-align: center;
  font-family: var(--font-serif);
  font-weight: var(--font-body-weight);
  font-size: var(--font-body-size);
  line-height: normal;
  color: var(--color-text);
  /* Cap-height to alphabetic baseline trim — see .home__brand-text */
  text-box-edge: cap alphabetic;
  text-box-trim: trim-both;
}

/* ---------- Full-bleed divider ---------- */

.home__divider {
  width: 100%;
  height: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--color-divider);
}

/* ---------- Inline tag (colored highlight inside a sentence) ---------- */

.tag {
  /* Horizontal padding only — the colored background is painted by ::before
     extending 8px above and 14px below the line-box so the tag doesn't
     inflate line height and push surrounding text. */
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-style: solid;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
  text-decoration-skip-ink: none;
  vertical-align: baseline;
  /* Cap-height to alphabetic baseline trim — see .home__brand-text */
  text-box-edge: cap alphabetic;
  text-box-trim: trim-both;
}

.tag::before {
  /* Fixed-height pill behind the text — biased slightly downward so the
     baseline sits in the lower third (optical balance for the serif). */
  content: "";
  position: absolute;
  top: 55%;
  transform: translateY(-50%);
  height: 42px;
  left: 0;
  right: 0;
  background: var(--tag-bg);
  z-index: -1;
  transition: filter 175ms cubic-bezier(0.1, 0.9, 0.4, 1);
}

.tag:hover::before {
  filter: brightness(1.15);
}

.tag--blue {
  --tag-bg: var(--color-tag-blue);
}

.tag--olive {
  --tag-bg: var(--color-tag-olive);
}

.tag--red {
  --tag-bg: var(--color-tag-red);
}

.tag svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
  /* Optical nudge to sit on the serif baseline */
  transform: translateY(1px);
}

/* ---------- Bottom links (LinkedIn + Email) ---------- */

.home__links {
  padding: 60px 24px 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--color-text);
  border-radius: 100px;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--font-button-size);
  line-height: normal;
  letter-spacing: var(--font-button-letter-spacing);
  text-decoration: none;
  transition: opacity 175ms cubic-bezier(0.1, 0.9, 0.4, 1);
}

.link-pill:hover {
  opacity: 0.7;
}

.link-pill svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* ---------- Case study (minimal placeholder) ---------- */

.case-study {
  max-width: 720px;
  margin: 0 auto;
  padding: 120px 24px;
}

.case-study__back {
  display: inline-block;
  margin-bottom: 64px;
  font-family: var(--font-sans);
  font-size: 16px;
  letter-spacing: var(--font-button-letter-spacing);
  color: var(--color-text);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 175ms cubic-bezier(0.1, 0.9, 0.4, 1);
}

.case-study__back:hover {
  opacity: 1;
}

.case-study__title {
  margin: 0 0 32px;
  font-family: var(--font-serif);
  font-weight: var(--font-body-weight);
  font-size: 38px;
  line-height: 1.2;
  color: var(--color-text);
  text-box-edge: cap alphabetic;
  text-box-trim: trim-both;
}

.case-study__lede {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: var(--font-body-weight);
  font-size: 24px;
  line-height: 1.4;
  color: var(--color-text);
  opacity: 0.85;
}

/* ---------- Locked case study gate ---------- */

.gate {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 350ms cubic-bezier(0.1, 0.9, 0.4, 1);
}

.gate.is-unlocked {
  opacity: 0;
  pointer-events: none;
}

.gate__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.gate__label {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: var(--font-body-weight);
  font-size: 32px;
  line-height: normal;
  color: var(--color-text);
  text-box-edge: cap alphabetic;
  text-box-trim: trim-both;
}

.gate__input {
  width: 280px;
  padding: 12px 24px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 100px;
  color: var(--color-text);
  font-family: var(--font-serif);
  font-weight: var(--font-body-weight);
  font-size: 24px;
  line-height: normal;
  text-align: center;
  outline: none;
  transition: border-color 175ms cubic-bezier(0.1, 0.9, 0.4, 1);
}

.gate__hint {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--color-text-dim);
}

.gate.is-error .gate__input {
  border-color: var(--color-tag-red);
  animation: gate-shake 320ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
