/* ==========================================================================
   Shared design system — Anvita Tripathi portfolio
   ========================================================================== */

:root {
  --bg-grad-start: #f8ead0;
  --bg-grad-end: #efdaad;
  --bg: #f6e6bf;
  --surface: #faf0d5;
  --surface-solid: #fdf8ec;
  --text: #2b2520;
  --muted: #6f675f;
  --border: #ddc48f;
  --accent: #c9862c;
  --accent-strong: #a56c1e;
  --accent-soft: rgba(201, 134, 44, 0.14);
  --gold: rgba(245, 212, 75, 0.4);
  --shadow: 0 10px 30px rgba(43, 37, 32, 0.08);
  --shadow-hover: 0 18px 40px rgba(43, 37, 32, 0.16);
  --card-bg: rgba(250, 240, 213, 0.82);
  --tile-bg: rgba(255, 255, 255, 0.05);
  --overlay: rgba(255, 255, 255, 0.04);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg-grad-start: #211b13;
  --bg-grad-end: #17130d;
  --bg: #1c1710;
  --surface: #251f16;
  --surface-solid: #221c14;
  --text: #f2e9d8;
  --muted: #b7a98d;
  --border: #40372a;
  --accent: #e8b45c;
  --accent-strong: #f2c67a;
  --accent-soft: rgba(232, 180, 92, 0.16);
  --gold: rgba(245, 212, 75, 0.32);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 18px 45px rgba(0, 0, 0, 0.55);
  --card-bg: rgba(37, 31, 22, 0.86);
  --tile-bg: rgba(255, 255, 255, 0.03);
  --overlay: rgba(255, 255, 255, 0.03);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: "Times New Roman", Times, serif;
  font-weight: 400;
  background: linear-gradient(135deg, var(--bg-grad-start) 0%, var(--bg-grad-end) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.7;
  transition: background 0.4s ease, color 0.4s ease;
}

.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 28px 24px 72px;
  position: relative;
  isolation: isolate;
}

h1, h2, h3 {
  font-family: "Kunstler Script", "Brush Script MT", "Segoe Script", cursive;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ---- Progress bar (essay/poem pages) ---- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  z-index: 100;
  transition: width 0.1s ease-out;
}

/* ---- Nav ---- */
nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 -24px 24px;
  padding: 16px 24px;
  transition: background 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease;
  border-radius: 0 0 18px 18px;
}

nav.scrolled {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

nav a {
  position: relative;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

nav.section a,
nav a.nav-pill {
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

nav.section a:hover,
nav a.nav-pill:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

nav a:not(.nav-pill):not(.theme-toggle)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -4px;
  height: 2px;
  background: var(--accent);
  transition: right 0.25s ease;
}

nav a:not(.nav-pill):not(.theme-toggle):hover::after,
nav a.active:not(.nav-pill)::after {
  right: 0;
}

nav a:hover { color: var(--accent-strong); }
nav a.active { color: var(--accent-strong); font-weight: 600; }
nav a.nav-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}

.nav-spacer { flex: 1; }

/* ---- Theme toggle ---- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  transition: transform 0.3s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px) rotate(12deg);
  box-shadow: var(--shadow-hover);
}

.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---- Entrance fade-in ----
   Pure CSS, no JS involved — guaranteed to play regardless of scripting. */
.reveal {
  animation: reveal-in 0.6s ease-out both;
}

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- Cards / sections ---- */
.card, .section {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease, transform 0.3s ease, background 0.4s ease, border-color 0.4s ease;
}

.section { margin-bottom: 18px; }

.card::before,
.card::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0.45;
}

.card::before {
  top: 12px;
  left: 12px;
  width: 76px;
  height: 76px;
  border-left: 2px solid var(--gold);
  border-top: 2px solid var(--gold);
  border-radius: 10px 0 0 0;
}

.card::after {
  bottom: 12px;
  right: 12px;
  width: 84px;
  height: 84px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  border-radius: 0 0 12px 0;
}

h1 {
  margin-top: 0;
  font-size: 2rem;
  margin-bottom: 10px;
}

/* Cursive reads smaller/thinner than serif at the same size, so bump it
   up wherever headings keep the cursive font (i.e. not .plain-headings). */
.page:not(.plain-headings) h1 { font-size: 3.2rem; }
.page:not(.plain-headings) h2 { font-size: 2.2rem; }

.intro, .lead, .subtitle {
  color: var(--muted);
  margin-bottom: 18px;
}

.subtitle { margin: 0; font-size: 0.95rem; }

/* ---- Avatar (about) ---- */
.avatar-frame {
  width: 260px;
  height: 260px;
  margin: 4px 0 24px;
  border-radius: 50%;
  padding: 6px;
  background: linear-gradient(145deg, var(--accent), var(--gold));
  box-shadow: var(--shadow);
}

.avatar-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--surface);
}

@media (max-width: 640px) {
  .avatar-frame { width: 180px; height: 180px; }
}

p, li { color: var(--text); }

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

/* ---- Section badge dots ---- */
.section-badge { display: flex; gap: 8px; margin-bottom: 10px; }
.section-badge span {
  width: 8px; height: 8px;
  border: 1px solid var(--border);
  background: var(--accent);
  border-radius: 50%;
}

/* ---- Quote box ---- */
.quote-box {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin: 16px 0 20px;
  background: var(--surface);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.quote, .quote-author { color: var(--text); }
.quote-author { margin-top: 8px; color: var(--muted); }

blockquote {
  margin: 18px 0 22px;
  padding: 14px 16px;
  border-left: 2px solid var(--gold);
  background: var(--overlay);
  color: var(--text);
  border-radius: 0 12px 12px 0;
}

/* ---- Doodle row (index) ---- */
.doodle-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.doodle {
  flex: 1;
  min-width: 100px;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bg-grad-start) 0%, var(--bg-grad-end) 100%);
  transition: transform 0.3s ease;
}
.doodle:hover { transform: translateY(-3px) scale(1.02); }

.work-list { padding-left: 18px; margin: 0; }

footer {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 24px;
  text-align: left;
}

/* ---- Hero (index) ---- */
.hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 4px 32px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.hero-eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  font-size: clamp(3rem, 7vw, 4.6rem);
  margin: 0;
  line-height: 1.1;
  background: linear-gradient(120deg, var(--text) 40%, var(--accent-strong) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-tagline {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0;
}

.hero-socials { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

.hero-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hero-social:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.hero-social svg { width: 16px; height: 16px; }

/* ---- Featured work (index) ---- */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.featured-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.featured-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
  color: var(--text);
}

.featured-kicker {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 8px;
}

.featured-title { font-family: "Kunstler Script", "Brush Script MT", "Segoe Script", cursive; font-size: 1.8rem; margin: 0; }

/* ---- Plain-headings override (about, work, and content pages) ---- */
.plain-headings h1,
.plain-headings h2,
.plain-headings h3 {
  font-family: "Times New Roman", Times, serif;
}

.literary-block { margin-top: 18px; padding: 16px 0 0; border-top: 1px solid var(--gold); }

/* ---- Work page ---- */
.section-buttons { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

.section-buttons button, .filter-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-family: inherit;
  font-size: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.filter-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #201a10;
  font-weight: 600;
}

[data-theme="dark"] .filter-btn.active { color: #1c1710; }

.section-block { margin-top: 16px; transition: opacity 0.25s ease; }
.section-block.is-hidden { display: none; }
.section-block h2 { font-size: 1rem; margin-bottom: 8px; font-weight: 500; }
.section-block ul { color: var(--text); padding-left: 0; margin: 0; list-style: none; }
.section-block li { margin-bottom: 8px; }

.work-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.work-link:hover {
  background: var(--accent-soft);
  color: var(--text);
  transform: translateX(4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

/* ---- Contact page ---- */
.contact-grid { display: grid; gap: 12px; margin-top: 20px; }

.contact-tile {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.contact-tile:hover { transform: translateY(-3px) translateX(2px); box-shadow: var(--shadow-hover); border-color: var(--accent); }

.contact-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.contact-icon { width: 14px; height: 14px; display: inline-block; flex-shrink: 0; color: var(--text); }
.contact-icon svg { width: 100%; height: 100%; fill: currentColor; }

.contact-value {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  word-break: break-word;
  margin-left: 22px;
}

/* ---- Essay / poem typography ---- */
.essay { color: var(--muted); font-size: 1rem; }
.essay p { margin: 0 0 14px; }
.essay strong { color: var(--text); }
.essay h2 { color: var(--text); font-size: 1.14rem; margin: 24px 0 10px; letter-spacing: 0.02em; }
.essay ul { padding-left: 20px; margin: 0 0 14px; }
.essay li { margin-bottom: 7px; }

.essay figure, .poem figure { margin: 20px 0 24px; overflow: hidden; border-radius: 14px; }

.essay img, .poem img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--gold);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.5s ease;
}

.essay figure:hover img, .poem figure:hover img { transform: scale(1.03); }

.essay figcaption, .poem figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--muted); text-align: center; }

.poem { color: var(--text); font-size: 1rem; }
.poem p { margin: 0 0 14px; }

/* ---- Stagger delays for grid reveals ---- */
.contact-grid .reveal:nth-child(2),
.featured-grid .reveal:nth-child(2) { animation-delay: 0.08s; }

.contact-grid .reveal:nth-child(3),
.featured-grid .reveal:nth-child(3) { animation-delay: 0.16s; }

.contact-grid .reveal:nth-child(4) { animation-delay: 0.24s; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .page { padding: 20px 16px 56px; }
  nav { margin: 0 -16px 20px; padding: 12px 16px; }
  .featured-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.6rem; }
  .page:not(.plain-headings) h1 { font-size: 2.4rem; }
  .page:not(.plain-headings) h2 { font-size: 1.8rem; }
  .doodle { min-width: 70px; }
}

@media (max-width: 360px) {
  .doodle-row { flex-wrap: nowrap; }
  .doodle { min-width: 0; }
}

/* ---- Focus visibility ---- */
a:focus-visible, button:focus-visible, .theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
