/* ============================================
   Natalie Tan — shared styles for every page
   To change the accent colour, edit --red below.
   ============================================ */

:root {
  --red: #8B1A1A;        /* accent: hover, section labels, header line */
  --ink: #1a1a1a;        /* main text */
  --grey: #6b6b6b;       /* secondary text */
  --bg: #ffffff;
}

* { box-sizing: border-box; }

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* ---------- Header: name + email on top, menu spread underneath ---------- */

.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  row-gap: 0.35rem;
  padding: 20px 32px 14px;
  border-bottom: 1px solid var(--red);
}

.site-name {
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.header-email {
  font-size: 0.85rem;
  color: var(--grey);
}

.site-nav {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 520px;       /* how wide the menu band is on big screens */
  justify-self: center;
}

.site-nav a { font-size: 1rem; }

.site-nav a:hover { color: var(--red); }

.site-nav a.current { font-weight: 600; }

/* ---------- Link buttons (underlined text, red on hover) ---------- */

.buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1.5rem 0 0;
}

.btn {
  display: inline-block;
  padding: 0.1em 0;
  font-size: 0.92rem;     /* just under the intro text (0.95rem) */
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.15s;
}

.btn:hover { color: var(--red); }

/* ---------- Home page ---------- */

.home {
  min-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 3rem 1.5rem 6rem;
}

.headshot {
  display: block;
  width: 128px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  margin: 0 auto 1.5rem;
  background: #eeeeee;
}

.home h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

.home p {
  max-width: 36em;
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- Intro line (Writing + Photography) ---------- */

.page-intro {
  text-align: center;
  padding: 4rem 1.5rem 2.5rem;
}

.page-intro p { margin: 0 auto; max-width: 40em; font-size: 0.95rem; }

/* when the buttons come before the intro text (Writing page) */
.page-intro .buttons:first-child { margin: 0 0 1.25rem; }

/* ---------- Writing + CV lists ---------- */

.writing {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

.writing h2 {
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 2.5rem 0 0.5rem;
}

.writing h2:first-child { margin-top: 0; }

.writing ul { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }

.writing li > * {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
  padding: 0.4rem 0;
}

.writing .pub {
  flex-shrink: 0;
  text-align: right;
}

.writing li a:hover .title:not(:has(.t)),
.writing li a:hover .t {
  color: var(--red);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.writing .role {
  display: block;
  color: var(--grey);
  font-size: 0.9em;
}

/* ---------- CV page ---------- */

.cv { padding-top: 4rem; }

.cv .buttons { margin: 3rem 0 0; }

.intro-link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.intro-link:hover { color: var(--red); }

/* ---------- Photography page ---------- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.photo {
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.photo img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* Full-screen viewer when you click a photo */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  display: block;
}

.lightbox button {
  position: absolute;
  background: none;
  border: 0;
  color: #fff;
  font: inherit;
  font-size: 2rem;
  line-height: 1;
  padding: 1rem;
  cursor: pointer;
  opacity: 0.8;
}

.lightbox button:hover { opacity: 1; }
.lightbox .close { top: 0.5rem; right: 0.75rem; }
.lightbox .prev { left: 0.5rem; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: 0.5rem; top: 50%; transform: translateY(-50%); }

/* ---------- Tablets ---------- */

@media (max-width: 900px) {
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Phones ---------- */

@media (max-width: 640px) {
  body { font-size: 15px; line-height: 1.55; }

  .site-header { row-gap: 0.2rem; padding: 14px 16px; }

  .site-name { font-size: 1.2rem; }

  .header-email { font-size: 0.8rem; }

  .site-nav a { font-size: 0.85rem; }

  .btn { font-size: 0.87rem; }   /* just under the mobile intro text (0.9rem) */

  .home { padding: 2rem 1.25rem 4rem; }

  .headshot { width: 104px; margin-bottom: 1.25rem; }

  .home h1 { font-size: 1.7rem; }

  .home p, .page-intro p { font-size: 0.9rem; }

  .page-intro { padding: 2.5rem 1.25rem 1.75rem; }

  .writing { padding: 0 1.25rem 3.5rem; }

  .writing h2 { margin-top: 2rem; }

  .writing li > * {
    flex-direction: column;
    gap: 0;
    padding: 0.55rem 0;
  }

  .writing .pub {
    text-align: left;
    color: var(--grey);
    font-size: 0.85rem;
  }

  .cv { padding-top: 2.5rem; }

  /* CV keeps dates on the right, even on phones */
  .cv li > * { flex-direction: row; gap: 1rem; }
  .cv .pub { text-align: right; }

  .photo-grid { grid-template-columns: 1fr; }
}

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