/* =========================================================
   DESIGN TOKENS
   ========================================================= */
:root {
  /* Colors */
  --bg:            #FAF7F2;
  --surface:       #F2EBE1;
  --surface-hover: #EDE3D7;
  --rose:          #C27A60;
  --rose-dark:     #9E5E45;
  --sage:          #8AA98A;
  --text:          #2A2420;
  --text-muted:    #7A716A;
  --border:        #E8DDD5;
  --border-light:  #F0E8DF;

  /* Typography */
  --serif: 'Playfair Display', Georgia, serif;
  --sans:  'DM Sans', system-ui, -apple-system, sans-serif;

  /* Layout */
  --nav-h:        56px;
  --max-w:        900px;
  --section-pad:  80px;
  --r:            12px;
  --r-sm:         8px;

  /* Motion */
  --ease:  200ms ease;
  --ease-slow: 500ms ease;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button { font-family: var(--sans); }

/* =========================================================
   PASSWORD GATE
   ========================================================= */
#password-gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity var(--ease-slow);
}

#password-gate.fade-out {
  opacity: 0;
  pointer-events: none;
}

.gate-card {
  text-align: center;
  width: min(380px, 90vw);
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 4px 40px rgba(42, 36, 32, 0.09);
}

.gate-icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 18px;
}

.gate-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.gate-hint {
  font-size: 0.83rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 28px;
}

#password-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color var(--ease);
}
.toggle-password:hover { color: var(--text); }

#password-input {
  width: 100%;
  padding: 12px 44px 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.05em;
  outline: none;
  transition: border-color var(--ease);
}

#password-input:focus { border-color: var(--rose); }

#password-form button {
  padding: 12px;
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background var(--ease);
}

#password-form button:hover { background: var(--rose-dark); }

.gate-error {
  min-height: 1.2em;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--rose-dark);
  font-style: italic;
}

/* =========================================================
   NAV  (starts hidden/transparent; revealed on auth)
   ========================================================= */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(250, 247, 242, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
  /* Start invisible — JS adds .visible */
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease-slow);
}

.site-nav.visible {
  opacity: 1;
  pointer-events: all;
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.nav-brand {
  font-family: var(--serif);
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  transition: color var(--ease);
}
.nav-brand:hover { color: var(--rose); }

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color var(--ease);
}
.nav-link:hover { color: var(--rose); }

/* =========================================================
   MAIN CONTENT  (starts invisible; revealed on auth)
   ========================================================= */
#main-content {
  padding-top: var(--nav-h);
  opacity: 0;
  transition: opacity var(--ease-slow);
}
#main-content.visible { opacity: 1; }

/* =========================================================
   SECTION WRAPPERS
   ========================================================= */
.section-wrap { width: 100%; }
.section-wrap--alt { background: var(--surface); }

.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--section-pad) 24px;
}

.section-title {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 36px;
}

.section-title::after {
  content: '';
  display: block;
  width: 36px;
  height: 2px;
  background: var(--rose);
  margin-top: 10px;
  border-radius: 2px;
}

/* =========================================================
   HERO
   ========================================================= */
.section-hero {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-inner { max-width: 560px; }

.hero-name {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 11vw, 6.5rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}

.hero-message {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.75;
  font-style: italic;
  max-width: 440px;
  margin: 0 auto;
}

/* TWSS easter egg — nearly invisible, no label */
.twss-trigger {
  display: inline-block;
  margin-top: 40px;
  font-size: 1rem;
  color: var(--border);
  cursor: default;
  position: relative;
  transition: color var(--ease);
  user-select: none;
}
.twss-trigger:hover { color: var(--text-muted); }

.twss-trigger::after {
  content: "That's what she said.";
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--text);
  color: var(--bg);
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.78rem;
  padding: 5px 11px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease);
}
.twss-trigger::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease);
}
.twss-trigger:hover::after,
.twss-trigger:hover::before { opacity: 1; }

/* =========================================================
   PHOTO CAROUSEL
   ========================================================= */
.carousel-wrapper { margin-bottom: 44px; }

.carousel {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
  height: min(520px, 68vh);
}

.carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.65s ease;
}
.carousel-slide.active { opacity: 1; }

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Placeholder tiles (when no photos) */
.carousel-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.carousel-placeholder-icon { font-size: 2.5rem; opacity: 0.4; }

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(250, 247, 242, 0.82);
  color: var(--text);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--ease), background var(--ease);
}
.carousel-btn:hover { opacity: 1; background: rgba(250, 247, 242, 0.97); }
.carousel-prev { left: 14px; }
.carousel-next { right: 14px; }

.carousel-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  z-index: 2;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: rgba(250, 247, 242, 0.45);
  transition: background var(--ease), transform var(--ease);
}
.carousel-dot.active {
  background: rgba(250, 247, 242, 0.95);
  transform: scale(1.35);
}

/* =========================================================
   ALBUM CARDS
   ========================================================= */
.album-section { margin-top: 8px; }

.album-heading {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.album-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.album-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.album-card:hover {
  background: var(--surface-hover);
  border-color: var(--rose);
  transform: translateY(-2px);
}
.album-icon { font-size: 1.2rem; flex-shrink: 0; }
.album-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

/* =========================================================
   NOTION LINK CARDS
   ========================================================= */
.notion-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notion-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.notion-card:hover {
  background: var(--surface-hover);
  border-color: var(--rose);
  transform: translateX(4px);
}
.notion-card-icon { font-size: 1.3rem; flex-shrink: 0; }
.notion-card-body { flex: 1; }
.notion-card-title {
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text);
}
.notion-card-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: transform var(--ease), color var(--ease);
}
.notion-card:hover .notion-card-arrow {
  transform: translateX(3px);
  color: var(--rose);
}

/* =========================================================
   WRITINGS SECTION
   ========================================================= */
.writings-intro {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: -20px;
  margin-bottom: 32px;
}

.writing-cards {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.writing-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 20px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
  border: 1px solid transparent;
}
.writing-card:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: translateX(4px);
}
.writing-card:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 2px;
}

.writing-card-num {
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  min-width: 24px;
}
.writing-card-text { flex: 1; }
.writing-card-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text);
}
.writing-card-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: transform var(--ease), color var(--ease);
}
.writing-card:hover .writing-card-arrow {
  transform: translateX(3px);
  color: var(--rose);
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  text-align: center;
  padding: 56px 24px 64px;
  border-top: 1px solid var(--border-light);
}

.footer-quote {
  font-family: var(--serif);
  font-size: 1rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 540px;
  margin: 0 auto 10px;
}

.footer-attr {
  font-size: 0.8rem;
  color: var(--border);
  letter-spacing: 0.04em;
}

/* =========================================================
   WRITING READING VIEW
   ========================================================= */
.writing-view {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  /* Starts invisible — JS adds .visible */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.writing-view.visible {
  opacity: 1;
  pointer-events: all;
}

.writing-view-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.writing-back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
  white-space: nowrap;
}
.writing-back-btn:hover {
  color: var(--text);
  border-color: var(--rose);
  background: var(--surface);
}

.writing-view-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writing-iframe {
  flex: 1;
  width: 100%;
  border: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 640px) {
  :root {
    --section-pad: 56px;
  }

  .nav-brand { display: none; }
  .nav-links { gap: 20px; }
  .nav-link { font-size: 0.82rem; }

  .album-cards {
    grid-template-columns: 1fr 1fr;
  }

  .writing-card { padding: 18px 12px; gap: 14px; }
  .writing-card-title { font-size: 1.05rem; }

  .gate-card { padding: 36px 28px; }
}

@media (max-width: 400px) {
  .album-cards { grid-template-columns: 1fr; }
  .nav-links { gap: 14px; }
}
