/* ============================================================
   JOSEPH BERTINO — styles.css
   ============================================================ */

/* ── Fonts ────────────────────────────────────────────────── */
/* Self-hosted latin subsets (preloaded in index.html). Each family gets a
   local Arial fallback scaled to match its metrics, so the swap from fallback
   to web font doesn't reflow text. Recompute the overrides if a font changes. */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/hanken-grotesk-latin-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter-tight-latin-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Hanken Grotesk Fallback';
  src: local('Arial'), local('ArialMT'), local('Liberation Sans');
  size-adjust: 101.53%;
  ascent-override: 98.49%;
  descent-override: 29.84%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Inter Tight Fallback';
  src: local('Arial'), local('ArialMT'), local('Liberation Sans');
  size-adjust: 96.64%;
  ascent-override: 100.24%;
  descent-override: 24.96%;
  line-gap-override: 0%;
}

/* ── Custom properties ────────────────────────────────────── */
:root {
  /* Colors */
  --color-bg:             #FBF3EC;
  --color-text:           #111111;
  --color-text-body:      #323232;
  --color-text-secondary: #6B6560;
  --color-border:         #E8E0D8;

  /* Spacing */
  --space-1:  8px;
  --space-2:  16px;
  --space-3:  24px;
  --space-4:  32px;
  --space-8:  64px;
  --space-12: 96px;

  /* Shape */
  --radius: 12px;

  /* Motion */
  --duration-base: 250ms;

  /* Layout */
  --max-width: 1440px;
  --cols:    12;
  --gutter:  24px;
  --margin:  156px;       /* side margin: 1128px of content at 1440 */
  --content: 4 / span 6;  /* the text column: 6 of 12 columns, centered (552px at 1440) */
  --font-base: 'Inter Tight', 'Inter Tight Fallback', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Hanken Grotesk', 'Hanken Grotesk Fallback', var(--font-base);
}

@media (max-width: 1280px) { :root { --margin: 64px; } }
@media (max-width: 1024px) { :root { --cols: 8; --margin: 40px; --content: 2 / span 6; } }
@media (max-width: 768px)  { :root { --content: 1 / -1; } }
@media (max-width: 640px)  { :root { --cols: 4; --gutter: 16px; --margin: 16px; } }

/* ── Reset & base ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
}

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

body {
  font-family: var(--font-base);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

ul {
  list-style: none;
}

/* Links show a 13px blue dot (#2c42ff) as the cursor; the hotspot is its center.
   Falls back to the normal pointer if the image can't load. */
a {
  color: inherit;
  text-decoration: none;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='%232c42ff'/%3E%3C/svg%3E") 8 8, pointer;
}

/* ── Skip link ────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-text);
  color: #fff;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius);
  font-size: 0.875rem;
  z-index: 200;
  text-decoration: none;
}

/* Higher specificity than the global :focus-visible rule, which would
   otherwise reset this radius to 2px. */
.skip-link:focus {
  top: var(--space-2);
  border-radius: var(--radius);
}

/* ── Focus styles ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Layout utility ───────────────────────────────────────── */
/* 12-column grid (8 on tablet, 4 on mobile). Every direct child sits in the
   same text column, so the photo, headline, bio and footer share both edges. */
.container {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--margin);
}

.container > * {
  grid-column: var(--content);
}

.section-body p + p {
  margin-top: var(--space-3);
}

/* Body links: underlined so they read as links without a color accent */
.section-body a {
  text-decoration: underline;
  text-decoration-color: var(--color-text-secondary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--duration-base) ease,
              text-underline-offset var(--duration-base) ease;
}

.section-body a:hover,
.section-body a:focus-visible {
  text-decoration-color: currentColor;
  text-underline-offset: 4px;
}

/* ── Animations ───────────────────────────────────────────── */
/* Starts at 0.01, not 0: Chrome ignores fully transparent elements for LCP,
   so a zero start would delay the hero's LCP until the fade begins. */
@keyframes fade-up {
  from { opacity: 0.01; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero ─────────────────────────────────────────────────── */
#hero {
  padding-top: var(--space-12);
  padding-bottom: var(--space-3);
}

#hero h1 {
  font-family: var(--font-display);
  font-size: 58px;
  font-weight: 400;
  line-height: 66px;
  letter-spacing: -1px;
  font-kerning: normal;
  margin-top: var(--space-8);
  text-wrap: balance;
  animation: fade-up 0.5s 0.1s ease-out both;
}

.hero-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 630;
  border-radius: var(--radius);
  overflow: hidden;
  animation: fade-up 0.6s ease-out both;
}

/* ── About ────────────────────────────────────────────────── */
#about {
  padding-bottom: var(--space-12);
}

#about .section-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text-body);
}

/* Avoids one-word last lines; ignored where unsupported */
#about .section-body p {
  text-wrap: pretty;
}

/* ── Footer ───────────────────────────────────────────── */
#footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-4);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-left: auto;
  margin-right: -8px; /* offsets the links' tap-target padding so text aligns to the column edge */
}

.footer-links a {
  display: inline-block;
  padding: 12px 8px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.footer-links a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #hero h1,
  .hero-image {
    animation: none;
  }

  .section-body a {
    transition: none;
  }
}

/* ── Responsive — 768px ───────────────────────────────────── */
@media (max-width: 768px) {
  /* Hero */
  #hero {
    padding-top: var(--space-8);
    padding-bottom: var(--space-3);
  }

  #hero h1 {
    font-size: 40px;
    line-height: 48px;
  }

  /* About */
  #about {
    padding-bottom: var(--space-8);
  }
}

/* ── Responsive — 480px ───────────────────────────────────── */
@media (max-width: 480px) {
  /* Footer: links first (they wrap), copyright below, all left-aligned */
  .footer-inner {
    flex-direction: column-reverse;
    align-items: flex-start;
  }

  .footer-links {
    margin-left: -8px;
    margin-right: 0;
  }
}
