/*
  William Buffington, MD — Personal Site
  Aesthetic: Scholarly warmth meets contemporary minimalism
*/

/* ========== FONTS ========== */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&display=swap');

/* ========== CSS VARIABLES ========== */
:root {
  /* Colors - refined, sophisticated palette */
  --bg-primary: #FDFCFB;
  --bg-secondary: #F8F7F5;
  --text-primary: #1A1918;
  --text-secondary: #4A4845;
  --text-tertiary: #8A8580;
  --accent: #9E8A70;
  --accent-hover: #7D6B54;
  --border-light: rgba(0, 0, 0, 0.06);
  --border-medium: rgba(0, 0, 0, 0.1);

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing - generous, intentional */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --space-xxl: 8rem;

  /* Layout */
  --content-width: 600px;
  --content-width-wide: 720px;

  /* Transitions */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* ========== RESET & BASE ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-secondary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

::selection {
  background: var(--accent);
  color: white;
}

/* ========== LANDING PAGE (PORTAL) ========== */
.portal {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  text-align: center;
}

.symbol-link {
  display: block;
  margin-bottom: var(--space-md);
  text-decoration: none;
}

.portal-symbol {
  width: auto;
  height: 240px;
  cursor: pointer;
  transition: transform 0.5s var(--ease-out),
              opacity 0.4s var(--ease-out),
              filter 0.5s var(--ease-out);
  opacity: 0.75;
  filter: drop-shadow(0 0 0 transparent);
}

.portal-symbol:hover {
  transform: translateY(-3px);
  opacity: 0.9;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}

/* Placeholder symbol - refined, minimal */
.symbol-placeholder {
  width: 160px;
  height: 160px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.6s var(--ease-out);
  opacity: 0.85;
}

.symbol-placeholder::before {
  content: '';
  position: absolute;
  width: 90px;
  height: 90px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0.6;
}

.symbol-placeholder::after {
  content: '';
  position: absolute;
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  border-radius: 50%;
  opacity: 0.8;
}

.symbol-placeholder:hover {
  opacity: 1;
  transform: scale(1.02);
}

.portal-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-primary);
}

/* ========== MAIN SITE LAYOUT ========== */
.site-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ========== NAVIGATION ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-primary);
  transition: all 0.3s var(--ease-out);
}

.site-header.scrolled {
  padding: var(--space-sm) var(--space-lg);
  background: rgba(253, 252, 251, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
}

.site-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
}

.nav-link {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: var(--space-xs) 0;
  position: relative;
  transition: color 0.3s var(--ease-out);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease-out);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-link.active {
  color: var(--text-primary);
}

.nav-separator {
  display: none;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
}

.content-container {
  width: 100%;
  max-width: var(--content-width);
}

.content-container.wide {
  max-width: var(--content-width-wide);
}

/* ========== TYPOGRAPHY ========== */
.page-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin-bottom: var(--space-xl);
  text-align: center;
}

.page-subtitle {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-tertiary);
  margin-bottom: var(--space-lg);
  text-align: center;
  margin-top: calc(var(--space-lg) * -1);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  letter-spacing: 0.02em;
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

p:last-child {
  margin-bottom: 0;
}

.lead {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-primary);
  font-weight: 400;
}

a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-medium);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.3s var(--ease-out);
}

a:hover {
  text-decoration-color: var(--accent);
}

/* ========== MEDIA LIST ========== */
.media-list {
  list-style: none;
}

.media-item {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border-light);
}

.media-item:first-child {
  padding-top: 0;
}

.media-item:last-child {
  border-bottom: none;
}

.media-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: var(--space-xs);
  transition: color 0.3s var(--ease-out);
}

.media-title:hover {
  color: var(--accent-hover);
}

.media-meta {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.media-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* ========== CONTACT ========== */
.contact-email {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-decoration-color: var(--accent);
}

.contact-note {
  text-align: center;
  color: var(--text-tertiary);
  margin-top: var(--space-xl);
  font-size: 0.85rem;
}

.contact-form {
  margin-top: var(--space-lg);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  transition: border-color 0.3s var(--ease-out), background-color 0.3s var(--ease-out);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-primary);
}

.form-textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.form-submit {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-medium);
  padding: var(--space-sm) var(--space-lg);
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
}

.form-submit:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ========== FOOTER ========== */
.site-footer {
  padding: var(--space-lg) var(--space-lg) var(--space-xl);
  text-align: center;
  margin-top: auto;
}

.footer-symbol-placeholder {
  width: 32px;
  height: 32px;
  margin: 0 auto var(--space-sm);
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0.3;
  transition: opacity 0.3s var(--ease-out);
}

.footer-symbol-placeholder:hover {
  opacity: 0.5;
}

.footer-symbol {
  width: auto;
  height: 56px;
  margin: 0 auto var(--space-sm);
  opacity: 0.4;
  transition: opacity 0.4s var(--ease-out);
  display: block;
}

.footer-symbol:hover {
  opacity: 0.6;
}

.footer-text {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ========== BOOKSHELF ========== */
.bookshelf-intro {
  text-align: center;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xl);
  font-style: italic;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.book-tile {
  position: relative;
  aspect-ratio: 2/3;
  cursor: pointer;
}

.book-cover-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.book-tile:hover .book-cover-wrapper {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.book-cover-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, var(--bg-secondary) 0%, #E8E6E3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-cover-placeholder::after {
  content: '';
  width: 30%;
  height: 2px;
  background: var(--border-light);
}

.book-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}

.book-cover.loaded {
  opacity: 1;
}

.book-info {
  position: absolute;
  inset: 0;
  background: rgba(26, 25, 24, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  text-align: center;
}

.book-tile:hover .book-info {
  opacity: 1;
}

.book-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 400;
  color: #FDFCFB;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.book-author {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: rgba(253, 252, 251, 0.6);
  letter-spacing: 0.02em;
}

.bookshelf-count {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
}

/* ========== PAGE TRANSITIONS ========== */
.page-enter {
  animation: fadeIn 0.6s var(--ease-out) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.portal-exit {
  animation: fadeOut 0.4s var(--ease-out) forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  :root {
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-xxl: 5rem;
  }

  .site-header {
    padding: var(--space-sm) var(--space-md);
  }

  .site-nav {
    gap: var(--space-md);
    flex-wrap: wrap;
  }

  .nav-link {
    font-size: 0.75rem;
  }

  .main-content {
    padding: var(--space-lg) var(--space-md) var(--space-xl);
  }

  .page-title {
    font-size: 1.9rem;
  }

  .portal-name {
    font-size: 1.2rem;
    letter-spacing: 0.15em;
  }

  .portal-symbol {
    height: 180px;
  }

  .footer-symbol {
    height: 48px;
  }

  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-sm);
  }
}

@media (max-width: 480px) {
  .site-nav {
    gap: var(--space-sm);
  }

  .nav-link {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
  }

  .portal-name {
    font-size: 1rem;
  }

  .page-title {
    font-size: 1.6rem;
  }
}

/* ========== UTILITY ========== */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-tertiary);
}

.mt-xl {
  margin-top: var(--space-xl);
}
