/*
  Atharv Bagade: personal site.
  One screen, no page scroll. Monochrome theme with dark/light modes.
  Desktop: section links top-right; Hello shows a tilted print over a blurred copy of the photo.
  Phone (<= 720px): bottom tab bar; Hello shows the photo full-screen; each section scrolls inside the screen.
*/

/* ---------- Theme tokens ---------- */
:root {
  --bg: #FAFAF8;
  --sunk: #F3F3F0;
  --card: #FFFFFF;
  --ink: #111111;
  --on-ink: #FFFFFF;
  --active: #ECECE8;
  --hover: #F0F0EC;
  --line: #E6E6E2;
  --line2: #D4D4CF;
  --dash: #BDBDB7;
  --muted: #6B6B66;
  --text2: #4A4A46;
  --text3: #3A3A36;
  --c1: #E4E4DF; --c2: #D2D2CC; --c3: #DCDCD7; --c4: #C9C9C3; --c5: #EFEFEB; --c6: #D6D6D1;
  --veil: rgba(250, 250, 248, .6);
  color-scheme: light;

  --font-display: 'Sentient', Georgia, 'Times New Roman', serif;
  --font-ui: 'Chillax', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --pad-x: 44px;
  /* Colours used on top of the photo (phone Hello). Overridden there. */
  --nav-ink: var(--ink);
  --nav-line: var(--line2);
}

:root[data-theme="dark"] {
  --bg: #0F0F0F;
  --sunk: #141414;
  --card: #1A1A1A;
  --ink: #EDEDEA;
  --on-ink: #0F0F0F;
  --active: #222222;
  --hover: #1C1C1C;
  --line: #262626;
  --line2: #3A3A3A;
  --dash: #4A4A4A;
  --muted: #9A9A94;
  --text2: #BDBDB7;
  --text3: #CFCFCB;
  --c1: #2A2A2A; --c2: #333333; --c3: #2E2E2E; --c4: #3A3A3A; --c5: #262626; --c6: #363636;
  --veil: rgba(12, 12, 12, .5);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 500; text-wrap: balance; }
h2 { font-weight: 400; font-size: 48px; line-height: 1.05; letter-spacing: -0.02em; }
h3 { font-size: 24px; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.eyebrow { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.lead { font-family: var(--font-display); font-size: 20px; line-height: 1.35; }

/* ---------- App shell: fills the screen, never scrolls ---------- */
.app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Hello backdrops ---------- */
.backdrop { position: absolute; inset: 0; opacity: 0; transition: opacity .4s ease; pointer-events: none; }
.backdrop-ambient {
  inset: -120px;
  background: url('img/hero.jpg') 55% 35% / cover;
  filter: blur(70px) saturate(1.35);
}
.backdrop-veil { background: var(--veil); }
.backdrop-photo { background: url('img/hero.jpg') 56% 28% / cover; }
.backdrop-shade {
  background:
    linear-gradient(to top, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, 0) 55%),
    linear-gradient(to bottom, rgba(0, 0, 0, .45) 0%, rgba(0, 0, 0, 0) 20%);
}
.app[data-section="hello"] .backdrop-ambient,
.app[data-section="hello"] .backdrop-veil { opacity: 1; }

/* ---------- Top bar ---------- */
.topbar {
  position: relative; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px;
  padding: 22px var(--pad-x);
}
.name { font-family: var(--font-display); font-weight: 500; font-size: 19px; color: var(--nav-ink); text-decoration: none; white-space: nowrap; }
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; }
.top-nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.top-nav a {
  display: flex; align-items: center; min-height: 40px;
  font-family: var(--font-ui); font-weight: 500; font-size: 15px; white-space: nowrap;
  color: var(--nav-ink); text-decoration: none; opacity: .62;
  border-bottom: 1px solid transparent;
}
.top-nav a:hover { opacity: 1; }
.top-nav a[aria-current="page"] { opacity: 1; border-bottom-color: var(--nav-ink); }
.theme-toggle {
  width: 36px; height: 36px; border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--nav-ink); border: 1px solid var(--nav-line);
}
:root[data-theme="dark"] .icon-moon, :root:not([data-theme="dark"]) .icon-sun { display: none; }

/* ---------- Main area and views ---------- */
main { position: relative; z-index: 1; flex: 1 1 0; min-height: 0; display: flex; }
.view {
  flex: 1 1 0; min-width: 0;
  overflow-y: auto;
  padding: 32px var(--pad-x);
  animation: view-in .3s ease;
}
.view > * + * { margin-top: 24px; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Hello ---------- */
.view-hello { position: relative; overflow: hidden; padding: 0; }
.hero {
  position: absolute; left: var(--pad-x); right: 54%; bottom: 64px;
  display: flex; flex-direction: column; gap: 18px;
}
.hero h1 { font-size: 56px; line-height: 1; letter-spacing: -0.025em; max-width: 13em; }
.hero h1 em { font-style: italic; color: var(--ink); }
.hero-muted { color: var(--muted); }
.hero p { font-family: var(--font-display); font-size: 20px; line-height: 1.5; color: var(--text2); }
.print {
  /* --print-centre places the print; the entrance animation reuses it so the two never fight. */
  --print-centre: translateY(-50%);
  position: absolute; right: 7%; top: 50%; width: min(40%, 560px); margin: 0;
  transform: var(--print-centre) rotate(2deg);
  background: #F4F1EA; padding: 14px 14px 54px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .2);
  animation: print-in .6s ease;
}
/* Its own keyframes: the shared view-in would replace the centring and tilt while it runs, then snap at the end. */
@keyframes print-in {
  from { opacity: 0; transform: var(--print-centre) translateY(16px) rotate(4deg); }
  to { opacity: 1; transform: var(--print-centre) rotate(2deg); }
}
.print img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: 55% 30%; }

/* ---------- Section headers ---------- */
.section-head { display: flex; flex-direction: column; gap: 4px; }
.section-head.split { flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.section-head.with-cover { flex-direction: row; align-items: flex-end; gap: 20px; }
.section-head.with-cover h2 { font-size: 52px; line-height: 1; }
.cover {
  flex: 0 0 120px; height: 120px; border-radius: 8px; background: var(--c3); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.music-head { flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 20px 32px; }
.music-head > div:last-child { flex: 1 1 320px; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; }
.music-photo { flex: 0 0 168px; width: 168px; height: 224px; object-fit: cover; object-position: 40% 40%; border-radius: 8px; }

/* ---------- Experience ---------- */
.tracks { border-bottom: 1px solid var(--line); }
.track {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px;
  padding: 18px 12px; border-top: 1px solid var(--line); border-radius: 4px;
}
.track:hover { background: var(--hover); }
.track-no, .track-date { font-family: var(--font-mono); font-size: 13px; }
.track-no { flex: 0 0 22px; }
.track-date { color: var(--text2); }
.track-body { flex: 1 1 380px; display: flex; flex-direction: column; gap: 6px; }
.bullets { list-style: disc; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--text2); max-width: 44em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { padding: 2px 10px; border: 1px solid var(--line2); border-radius: 999px; font-size: 12px; }

/* ---------- Tabs (Work and Music) ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs button {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; cursor: pointer;
  border: 1px solid var(--line2); border-radius: 999px; background: transparent; color: var(--ink);
  font-family: var(--font-ui); font-weight: 500; font-size: 14px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.tabs .count { font-family: var(--font-mono); font-size: 12px; opacity: .7; }
.tabs-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }

/* ---------- Work cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 22px;
  background: var(--card); border: 1px solid var(--line2); border-radius: 10px;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--ink); }
.card-tag { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.card h3 { font-size: 28px; letter-spacing: -0.01em; }
.card p { color: var(--text3); }
.card-link { margin-top: auto; display: flex; align-items: center; gap: 6px; min-height: 32px; font-family: var(--font-mono); font-size: 13px; }

/* ---------- Music lists ---------- */
.rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 0 28px; }
.rows.single { grid-template-columns: minmax(0, 640px); }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 8px;
  border-top: 1px solid var(--line); border-radius: 4px; color: var(--ink); text-decoration: none;
}
.row:hover { background: var(--hover); }
.row-no { flex: 0 0 22px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.avatar {
  flex: 0 0 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.row-name { flex: 1 1 0; min-width: 0; font-family: var(--font-ui); font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row svg { color: var(--muted); }
.recs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.rec { display: flex; flex-direction: column; gap: 8px; padding: 20px; background: var(--card); border: 1px solid var(--line2); border-radius: 10px; color: var(--ink); text-decoration: none; }
.rec-title { font-family: var(--font-display); font-weight: 500; font-size: 22px; line-height: 1.2; }
.rec-artist { color: var(--text2); font-size: 14px; }
.rec-why { margin-top: 4px; color: var(--text3); font-family: var(--font-display); font-style: italic; font-size: 15px; }
.rec-note { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- Stack and contact ---------- */
.contact-grid { display: flex; flex-wrap: wrap; gap: 28px 56px; }
.stack { flex: 1 1 360px; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 22px; }
.stack dt { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.stack dd { margin: 4px 0 0; }
.contact-links { flex: 1 1 280px; display: flex; flex-direction: column; gap: 8px; }
.contact-links a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--line2); border-radius: 8px; text-decoration: none;
  font-family: var(--font-mono); font-size: 14px; overflow-wrap: anywhere;
}
.contact-links a:hover { background: var(--hover); }

/* ---------- Phone tab bar (hidden on larger screens) ---------- */
.tabbar { display: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .hero { right: 50%; }
  .hero h1 { font-size: 46px; }
  .print { width: min(44%, 460px); }
}

/* ---------- Portrait tablets: photo centred in the upper part, title full width below ---------- */
@media (min-width: 721px) and (orientation: portrait) {
  .print {
    --print-centre: translate(-50%, -50%);
    left: 50%; right: auto; top: 40%;
    width: min(64%, 560px);
  }
  .hero { right: var(--pad-x); bottom: 56px; }
  .hero h1 { font-size: 56px; max-width: 14em; }
}

/* ---------- Phone ---------- */
@media (max-width: 720px) {
  :root { --pad-x: 20px; }
  .topbar { padding: 14px var(--pad-x); }
  .top-nav { display: none; }
  .view { padding: 20px var(--pad-x) 28px; }
  h2, .section-head.with-cover h2 { font-size: 36px; }
  .cover { flex-basis: 72px; height: 72px; }
  .cover svg { width: 32px; height: 32px; }

  /* Hello: photo full-screen, light text over it */
  .print { display: none; }
  .app[data-section="hello"] .backdrop-ambient,
  .app[data-section="hello"] .backdrop-veil { opacity: 0; }
  .app[data-section="hello"] .backdrop-photo,
  .app[data-section="hello"] .backdrop-shade { opacity: 1; }
  .app[data-section="hello"] { --nav-ink: #F5F5F2; --nav-line: rgba(245, 245, 242, .4); }
  .hero { left: var(--pad-x); right: var(--pad-x); bottom: 32px; gap: 12px; }
  .hero h1 { font-size: 40px; max-width: none; }
  .hero p { font-size: 17px; color: rgba(245, 245, 242, .85); }
  .hero-muted { color: rgba(245, 245, 242, .7); }
  .hero h1 em { color: #F5F5F2; }

  .tabbar {
    position: relative; z-index: 3; flex: 0 0 auto;
    display: flex; justify-content: space-around;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--bg); border-top: 1px solid var(--line);
  }
  .app[data-section="hello"] .tabbar {
    background: rgba(10, 10, 10, .35); border-top-color: rgba(245, 245, 242, .18);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  .tabbar a {
    flex: 1 1 0; min-width: 0; min-height: 52px; padding: 4px 2px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-family: var(--font-ui); font-weight: 500; font-size: 11px; white-space: nowrap;
    color: var(--nav-ink); opacity: .6; text-decoration: none;
  }
  .tabbar a[aria-current="page"] { opacity: 1; }
}

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