/* =============================================
   Nathan King — Personal Site
   Author & Photographer
   ============================================= */

/* Google Fonts — load in <head> with:
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500&display=swap" rel="stylesheet">
*/

/* ---- Reset & Base ---- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream:       #FAF6F0;
  --white:       #FFFFFF;
  --charcoal:    #1C1A18;
  --mid:         #4A4744;
  --muted:       #8A8480;
  --accent:      #8B6F47;
  --accent-light:#C4A882;
  --rule:        #1C1A18;

  --serif:    'Bodoni Moda', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Header/label font: Century Schoolbook (Mac/Win system font) with PT Serif as web fallback */
  --franklin: 'Century Schoolbook', 'New Century Schoolbook', 'Century Schoolbook L', 'PT Serif', Georgia, 'Times New Roman', serif;

  --max-w: 1100px;
  --gutter: clamp(1.25rem, 5vw, 3rem);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  font-weight: 300;
  background-color: var(--cream);
  color: var(--charcoal);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* Sticky footer: nav + main + footer stack vertically;
     main expands to fill remaining height, pushing footer to the bottom. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1 0 auto; }
footer { flex-shrink: 0; }

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

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

/* ---- Typography ---- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.2;
  color: var(--charcoal);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }
h4 { font-size: 1.1rem; }

p {
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  color: var(--mid);
  max-width: 65ch;
}

em { font-style: italic; }

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

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section {
  padding: clamp(3rem, 8vw, 6rem) 0;
}

.section-label {
  font-family: var(--franklin);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--charcoal);
  margin-bottom: 1rem;
}

hr.rule {
  border: none;
  border-top: 0.5px solid var(--rule);
  margin: 2.5rem 0;
}

/* ---- Navigation ---- */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(250, 246, 240, 0.92);
  backdrop-filter: blur(8px);
  /* Ornamental band replaces the old hairline */
}

nav::after {
  content: '';
  display: block;
  height: 22px;
  background: url('images/nav-divider.png') repeat-x center / auto 100%;
}

.nav-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.1rem var(--gutter);
  position: relative;
}

.nav-links {
  justify-content: center;
}

.nav-name {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: var(--charcoal);
  display: flex;
  align-items: center;
}

.nav-name img {
  height: 88px;
  width: auto;
  display: block;
}

@media (max-width: 640px) {
  .nav-name img { height: 72px; }
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--franklin);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--charcoal);
  transition: all 0.3s;
}

@media (max-width: 640px) {
  .nav-inner {
    /* keep flex-column from desktop so the logo stays centered */
    align-items: center;
    gap: 0;
  }

  .nav-toggle {
    display: flex;
    position: absolute;
    right: var(--gutter);
    top: 50%;
    transform: translateY(-50%);
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cream);
    border-bottom: 0.5px solid var(--rule);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0 1rem;
  }

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

  .nav-links li a {
    display: block;
    padding: 0.75rem var(--gutter);
  }
}

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

.hero {
  padding: clamp(4rem, 12vw, 9rem) 0 clamp(3rem, 8vw, 6rem);
  border-bottom: 0.5px solid var(--rule);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.hero-text h1 {
  margin-bottom: 1.25rem;
}

.hero-text h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero-text p {
  font-size: clamp(1rem, 2vw, 1.15rem);
  margin-bottom: 2rem;
}

.hero-image img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

@media (max-width: 768px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .hero-image { order: -1; }
  .hero-image img { aspect-ratio: 16 / 9; }
}

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

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.85rem 2rem;
  border: 1.5px solid var(--charcoal);
  color: var(--charcoal);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn:hover {
  background: var(--charcoal);
  color: var(--cream);
}

.btn-accent {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-accent:hover {
  background: var(--accent);
  color: var(--white);
}

/* ---- Books Grid ---- */

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2.5rem 2rem;
  margin-top: 2.5rem;
}

.book-card {
  display: flex;
  flex-direction: column;
}

.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  margin-bottom: 1rem;
  transition: opacity 0.3s;
}

.book-card:hover .book-cover {
  opacity: 0.85;
}

.book-meta {
  flex: 1;
}

.book-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.book-year {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.book-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--mid);
  max-width: none;
}

/* ---- Photography Grid ---- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 2.5rem;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.3s, transform 0.3s;
}

.photo-grid img:hover {
  opacity: 0.88;
}

/* Span some images for visual interest */
.photo-grid .wide {
  grid-column: span 2;
  aspect-ratio: 2 / 1;
}

.photo-grid .tall {
  grid-row: span 2;
  aspect-ratio: 1 / 2;
}

@media (max-width: 900px) {
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .photo-grid .wide { grid-column: span 2; aspect-ratio: 2 / 1; }
  .photo-grid .tall { grid-row: span 1; aspect-ratio: 1 / 1; }
}

@media (max-width: 540px) {
  .photo-grid { grid-template-columns: 1fr; }
  .photo-grid .wide { grid-column: span 1; aspect-ratio: 4 / 3; }
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 26, 24, 0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-close:hover { opacity: 1; }

/* ---- About ---- */

.about-inner {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 4rem;
  align-items: start;
}

.about-portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.about-text h2 {
  margin-bottom: 1.5rem;
}

.about-text p + p {
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .about-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .about-portrait { aspect-ratio: 4 / 3; }
}

/* ---- Contact ---- */

.contact-section {
  text-align: center;
  border-top: 0.5px solid var(--rule);
}

.contact-section h2 {
  margin-bottom: 1rem;
}

.contact-section p {
  margin: 0 auto 2rem;
  text-align: center;
}

.contact-email {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(0.95rem, 1.8vw, 1.2rem);
  color: var(--accent);
  border-bottom: 1px solid var(--accent-light);
  transition: color 0.2s, border-color 0.2s;
}

.contact-email:hover {
  color: var(--charcoal);
  border-color: var(--charcoal);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
  list-style: none;
}

.social-links a {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s;
}

.social-links a:hover {
  color: var(--accent);
}

/* ---- Footer ---- */

footer {
  border-top: 0.5px solid var(--rule);
  padding: 2rem var(--gutter);
  text-align: center;
}

footer p {
  font-family: var(--franklin);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  max-width: none;
  margin: 0 auto;
}

footer .terms-link {
  display: inline-block;
  margin-top: 0.45rem;
  font-family: var(--franklin);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

footer .terms-link:hover {
  color: var(--charcoal);
}

/* ---- Utilities ---- */

.text-center { text-align: center; }
.text-center p { margin-left: auto; margin-right: auto; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-6 { margin-top: 3rem; }

.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: none;
}
