/* ============================================================
   Lynn Teoh — Portfolio (placeholder)
   Plain HTML/CSS/JS. Shared stylesheet for index + about.
   ============================================================ */

/* ---- Design tokens ---------------------------------------- */
:root {
  --ink:        #1A1A1A;              /* primary text            */
  --ink-muted:  #1A1A1A80;             /* grey text (1A1A1A @ 50%) */
  --bg:         #F7F6F4;              /* page background         */

  --font-display: "Elsie", Georgia, serif;
  --font-body:    "Lato", -apple-system, BlinkMacSystemFont, sans-serif;

  --size-heading: 32px;   /* Elsie, consistent across screens  */
  --size-body:    16px;   /* Lato, consistent across screens   */

  /* title/subhead rhythm — reused wherever hero-style title + subhead
     pairs appear (currently the homepage hero; About page to follow) */
  --title-line-height:      1.15;  /* tightened from inherited 1.5 */
  --title-letter-spacing:   0.02em;
  --subhead-line-height:    1.3;   /* tightened from inherited 1.5 */
  --subhead-letter-spacing: 0.12em;

  --max-width: 1728px;
  --gutter:    24px;
  --margin:    40px;
}

/* ---- Reset-ish -------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* ---- Page shell ------------------------------------------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--margin);
}

/* ---- Header ----------------------------------------------- */
.masthead {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gutter);
}

.logo {
  font-family: var(--font-display);
  font-size: var(--size-heading);
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav a {
  font-family: var(--font-body);
  font-size: var(--size-body);
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

/* current page = solid black */
.nav a[aria-current="page"] { color: var(--ink); }

/* hover: darken to full black, bold, underline */
.nav a:hover,
.nav a:focus-visible {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* hamburger toggle: hidden above the tablet breakpoint, where the
   nav renders inline as plain text links. Positioned above the
   full-screen overlay (z-index) so it stays visible/clickable as
   the close (X) button once open. */
.nav-toggle {
  display: none;
  position: relative;
  z-index: 11;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}

/* dims page content behind the open nav panel */
.nav-backdrop {
  display: none;
}

/* ---- Home / hero ------------------------------------------ */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2rem;
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--size-heading);
  font-weight: 400;
  margin: 0;
  margin-top: auto;
  line-height: var(--title-line-height);
  letter-spacing: var(--title-letter-spacing);
}

.hero__ticker {
  font-family: var(--font-body);
  font-size: var(--size-body);
  margin-top: -1rem;
  line-height: var(--subhead-line-height);
  letter-spacing: var(--subhead-letter-spacing);
  color: var(--ink-muted);
  text-transform: uppercase;
}

.hero__flower {
  width: auto;
  height: clamp(240px, 40vh, 480px);
  object-fit: contain;
}

.hero__footer {
  margin-top: auto;
  font-size: var(--size-body);
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
  align-items: center;
  align-self: flex-start;
}

.hero__footer a {
  color: var(--ink-muted);
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: color 0.15s ease;
}

.hero__footer a:hover,
.hero__footer a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- About: bio ------------------------------------------- */
.about { margin-top: 4rem; }

.section-title {
  font-family: var(--font-display);
  font-size: var(--size-heading);
  font-weight: 400;
  margin: 0 0 2rem 0;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.bio {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--gutter);
  align-items: start;
  margin-bottom: 6rem;
}

/* the heading spans the first column; the two paragraphs fill the rest */
.bio__title { grid-column: 1; }
.bio__col   { grid-column: auto; margin: 0; max-width: 42ch; }

/* ---- About: friends --------------------------------------- */
/* F-shaped layout: heading occupies column 1 for every row,
   friend cards auto-flow through columns 2–3 to its right */
.friends {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem var(--gutter);
}

/* grid-row span is explicit (not 1 / -1) because -1 resolves against
   the explicit grid, not the implicit rows auto-placed cards create —
   with only the heading explicitly positioned, that left column 1 open
   past row 1 and cards started filling it. Update the span whenever a
   friend is added or removed: span = ceil(friend count / 2). 16
   friends currently -> 8 rows. */
.friends__title {
  grid-column: 1;
  grid-row: 1 / span 8;
  margin: 0;
}

.friend {
  display: block;
  text-decoration: none;
  color: inherit;
}

.friend__name {
  font-family: var(--font-body);
  font-size: var(--size-body);
  color: var(--ink);
  margin: 0;
}

.friend__role,
.friend__link {
  font-family: var(--font-body);
  font-size: var(--size-body);
  color: var(--ink-muted);
  margin: 0;
  transition: color 0.15s ease;
}

.friend__link { display: inline-block; }

/* footer sits well below the friends grid, echoing the bio->friends
   section gap rather than the tighter 2rem hero rhythm */
.about .hero__footer { margin-top: 6rem; }

/* Hover (the Brian move): whole card darkens to full black,
   the domain line underlines. Works on <a> cards only. */
.friend:not(.friend--nolink):hover .friend__link,
.friend:not(.friend--nolink):focus-visible .friend__link {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Responsive ------------------------------------------- */

/* Site's two standard breakpoints: 1024px (tablet) and 768px (mobile).
   Every responsive section should hang off one of these two values
   rather than introducing its own. */

/* 1024 and down: bio heading gets its own row, paragraphs sit 2-up;
   friends drops its F-shape — heading goes full-width above the
   grid, cards flow through 2 even columns underneath */
@media (max-width: 1024px) {
  .bio {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 3rem;
  }

  .about .hero__footer { margin-top: 3rem; }
  .bio__title { grid-column: 1 / -1; }
  .bio__col { max-width: none; }

  .friends {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 1.5rem;
  }

  .friends__title {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  /* nav collapses into a hamburger; open state is a full-screen
     light panel, with a separate dark backdrop dimming the page
     content behind it */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9;
  }

  .nav {
    display: none;
    position: fixed;
    inset: 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem;
    background: var(--bg);
    padding: var(--margin);
    z-index: 10;
  }

  .nav.is-open {
    display: flex;
  }

  .nav a {
    font-size: 2rem;
  }
}

/* 768 and down: everything stacks to a single column, including
   the friends heading, which drops back above the cards */
@media (max-width: 768px) {
  .page { padding: var(--margin) 24px; }
  .nav { padding: var(--margin) 24px; }

  .bio {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .friends {
    grid-template-columns: 1fr;
    margin-top: 1rem;
  }

  .friends__title {
    grid-column: 1;
    grid-row: auto;
    margin-bottom: 2rem;
  }
}

/* ---- Accessibility ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
