/* Prajwal Haniya — personal site
   Single-column, text-first layout. */

/* White theme: pure paper, near-black ink, editorial serif + Gill Sans UI */
:root {
  --bg: #ffffff;
  --surface: #e8f0f4;
  --surface-line: #b6cbd5;
  --ink: #141414;
  --ink-soft: #242424;
  --ink-faint: #606060;
  --line: #d5d5d5;
  --accent: #141414;
  --accent-ink: #ffffff;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Baskerville, Georgia, serif;
  --reading: "Spectral", Georgia, "Times New Roman", serif;
  --sans: "Gill Sans", "Gill Sans MT", ui-sans-serif, -apple-system, system-ui, "Helvetica Neue", Arial, sans-serif;
  --measure: 700px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--reading);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: #aaa9a1; text-underline-offset: 3px; }
a:hover { color: var(--ink); text-decoration-color: currentColor; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px;
}
.skip:focus { left: 16px; }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 20px; }

/* ---------- Header / nav ---------- */
.site-header { padding: 40px 0 8px; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--ink); text-decoration: none; }

/* Uppercase, tracked nav with a filled "My Book" button */
.nav {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  font-family: var(--sans); font-size: 13px; line-height: 21px;
  letter-spacing: .08em; text-transform: uppercase;
}
.nav a { text-decoration: none; color: var(--ink-faint); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.nav .book-link {
  background: var(--ink); color: #fff; padding: 7px 14px; border: 1px solid var(--ink);
}
.nav .book-link:hover { background: #383838; color: #fff; }

/* ---------- Typography ---------- */
main { padding: 48px 0 24px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; color: var(--ink); letter-spacing: -0.01em; line-height: 1.25; }
h2 { font-weight: 400; }
h1 { font-size: clamp(36px, 7vw, 52px); margin: 0 0 20px; }
h2 { font-size: 28px; margin: 56px 0 16px; }
h3 { font-size: 20px; margin: 0 0 4px; }

.lede { font-size: 20px; color: var(--ink-soft); margin: 0 0 16px; }
.lede strong { color: var(--ink); font-weight: 600; }
p { margin: 0 0 18px; }
.muted { color: var(--ink-faint); font-size: 15px; }
.eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin: 0 0 10px; }

/* ---------- Avatar ---------- */
.avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 30px; font-weight: 600;
  margin-bottom: 24px;
}

/* ---------- Newsletter card ---------- */
.signup {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  padding: 28px 30px 30px;
  margin: 32px 0;
  box-shadow: rgba(23, 84, 106, 0.05) 0 6px 22px;
}
.signup .btn, .signup input[type="email"] { border-radius: 4px; min-height: 50px; }
.signup input[type="email"] { background: #fff; border-color: #a4b7c1; }
.btn, .search { font-family: var(--sans); }
.btn { font-weight: 400; }
.signup h3 { font-size: 22px; margin-bottom: 6px; }
.signup p { color: var(--ink-soft); margin-bottom: 16px; }
.signup form { display: flex; gap: 8px; flex-wrap: wrap; }
.signup input[type="email"] {
  flex: 1 1 220px; min-width: 0;
  font: inherit; font-size: 16px;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.signup input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.signup .fine { font-size: 13px; color: var(--ink-faint); margin: 10px 0 0; }
/* Plain variant (Stories page): just the form, no blue box */
.signup.plain { background: none; border: 0; box-shadow: none; padding: 0; margin: 24px 0 40px; }
.signup.plain input[type="email"] { border-color: var(--line); }
.signup.plain input[type="email"]:focus { border-color: var(--ink); }

.btn {
  display: inline-block; font: inherit; font-size: 16px; font-weight: 600;
  padding: 12px 18px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--bg); text-decoration: none;
}
.btn:hover { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }

/* ---------- Lists ---------- */
.list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.list li { border-bottom: 1px solid var(--line); }
.list a.row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 0; text-decoration: none; }
.list a.row:hover .t { color: var(--accent); }
.list .t { font-weight: 500; }
.list .d { color: var(--ink-faint); font-size: 14px; white-space: nowrap; }
.list .dek { display: block; color: var(--ink-soft); font-size: 15px; font-weight: 400; margin-top: 2px; }
.list .tag { font-size: 12px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; margin-left: 8px; vertical-align: 2px; }

.more { display: inline-block; margin-top: 16px; font-weight: 500; text-decoration: none; color: var(--accent); }

/* ---------- Cards (things I'm building / books) ---------- */
.cards { display: grid; gap: 12px; }
.card {
  display: block; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; background: var(--bg); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); color: inherit; }
.card p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.card .meta { font-size: 13px; color: var(--ink-faint); margin-top: 8px; }

.book { display: grid; grid-template-columns: 88px 1fr; gap: 20px; align-items: start; }
.cover {
  width: 88px; aspect-ratio: 2 / 3; border-radius: 4px 8px 8px 4px;
  display: flex; align-items: flex-end; padding: 8px;
  font-family: var(--serif); font-size: 11px; line-height: 1.2; font-weight: 600; color: #fff;
  box-shadow: inset 4px 0 0 rgba(0,0,0,.18), 0 6px 14px rgba(0,0,0,.12);
}
.cover.c1 { background: #3f5d4a; }
.cover.c2 { background: #9d3b4f; }
.cover.c3 { background: #24384f; }

/* ---------- About timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.timeline li:first-child { border-top: 1px solid var(--line); }
.timeline .yr { font-family: var(--serif); font-weight: 600; color: var(--accent); }

.skills { display: grid; gap: 10px; margin: 0; }
.skills div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.skills dt { color: var(--ink-faint); font-size: 15px; }
.skills dd { margin: 0; }

.signature { font-family: var(--serif); font-style: italic; font-size: 26px; margin-top: 4px; }

/* ---------- Writing page: tabs, search, year picker ---------- */
.tabs {
  display: flex; gap: 28px; margin: 32px 0 20px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none;
  padding: 10px 0 12px; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  font-family: var(--sans); font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint);
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab .n {
  font-size: 11px; letter-spacing: 0; color: var(--ink-faint);
  font-variant-numeric: tabular-nums; margin-left: 3px;
}
.tab:focus-visible, .link-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.search-wrap { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.search {
  width: 100%; font-size: 16px; padding: 10px 14px 10px 38px;
  border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.search:focus { outline: 0; border-color: var(--ink); }
.count { font-family: var(--sans); font-size: 13px; color: var(--ink-faint); margin: 10px 0 4px; min-height: 1em; }

.panel { margin-top: 28px; }
.panel-title { font-size: 24px; margin: 0 0 12px; }
.panel-title .muted { font-family: var(--reading); font-size: 15px; font-weight: 400; }
#results.single-tab .panel-title { display: none; }

/* Blog: year dropdown + compact bulleted list */
.blog-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.blog-bar .panel-title { margin: 0; }
#results.single-tab .blog-bar { justify-content: flex-end; }

.year-select {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint);
}
/* Custom white dropdown: no grey native chrome, own chevron */
.year-select select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  min-width: 150px;
  padding: 8px 36px 8px 12px;
  font-family: var(--sans); font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--ink);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23141414' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  border: 1px solid var(--line); border-radius: 6px;
  box-shadow: none; cursor: pointer;
}
.year-select select:hover { border-color: #a9a9a9; }
.year-select select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.year-select select:disabled { opacity: .45; cursor: default; }
.year-select option { background: #fff; color: var(--ink); }

.year-heading { font-size: 40px; font-weight: 700; line-height: 1.1; margin: 8px 0 14px; }
.year-group + .year-group .year-heading { margin-top: 36px; }

.post-list { margin: 0; padding-left: 1.2em; list-style: disc; }
.post-list li { margin: 0 0 6px; line-height: 1.5; padding-left: 2px; }
.post-list li::marker { color: var(--ink); }
.post-list a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.post-list a:hover { text-decoration-thickness: 2px; }
.post-list .sep { color: var(--ink-faint); margin: 0 2px; }
.post-list time { color: var(--ink-soft); white-space: nowrap; }

.empty { margin: 24px 0; color: var(--ink-faint); }
@media (max-width: 520px) {
  .tabs { gap: 20px; }
  .year-heading { font-size: 32px; }
  .post-list li { font-size: 17px; }
}
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; }

/* ---------- Minimal home page ---------- */
body.home { display: flex; flex-direction: column; min-height: 100svh; }
.home-main {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  width: min(100%, 764px); margin: 0 auto; padding: 80px 32px 40px;
}
.intro-copy {
  font-family: var(--serif); font-weight: 400; color: var(--ink);
  font-size: 28.5px; line-height: 1.54; letter-spacing: normal;
  text-wrap: balance; margin: 0 0 36px;
}
.intro-copy strong { font-weight: 700; }
.intro-copy .keep { white-space: nowrap; }
.home-nav .contact-link { margin-left: auto; }
.portrait { display: none; }

/* Home short-story signup: mobile only (shown in the 620px block below) */
.home-signup { display: none; }
@media (max-width: 620px) {
  .home-signup { display: block; width: 100%; margin-top: 32px; text-align: center; }
  .home-signup p { margin: 0 auto 12px; font: 14px/1.4 var(--sans); color: var(--ink-faint); text-wrap: balance; }
  .home-signup form { display: flex; flex-direction: column; gap: 14px; }
  .home-signup input {
    width: 100%; min-height: 44px; padding: 6px 0;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
    background: #fff; color: var(--ink); font: 16px/24px var(--sans);
  }
  .home-signup input::placeholder { color: var(--ink-faint); opacity: 1; }
  .home-signup input:focus { outline: 0; border-bottom-color: var(--ink); }
  .home-signup button {
    width: 100%; min-height: 44px; padding: 6px 12px;
    border: 1px solid var(--ink); border-radius: 0; cursor: pointer;
    background: var(--ink); color: #fff; font: 15px/24px var(--sans);
  }
  .home-signup button:hover { background: #383838; }
}


.utility-footer { padding: 24px 32px 32px; text-align: center; }
.utility-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 24px; }
.utility-footer a { font: 13px/1.5 var(--sans); color: var(--ink-faint); text-decoration: none; }
.utility-footer a:hover { color: var(--ink); }

/* Mobile home: portrait, centred intro, stacked full-width buttons */
@media (max-width: 620px) {
  .home-main { justify-content: flex-start; align-items: center; text-align: center; padding: 40px 16px 24px; }
  .portrait {
    display: block; width: 96px; height: 96px; margin: 0 auto 18px;
    border-radius: 50%; object-fit: cover; background: var(--line);
  }
  .intro-copy { font-size: 19px; line-height: 1.5; color: var(--ink-soft); margin: 0 0 28px; text-wrap: balance; }
  .intro-copy strong {
    display: block; margin-bottom: 12px;
    font-size: clamp(26px, 7.6vw, 32px); font-weight: 400; line-height: 1.2; color: var(--ink);
  }
  .home-nav {
    width: 100%; flex-direction: column; align-items: stretch; gap: 8px;
    font-size: 15px; letter-spacing: 0; text-transform: none;
  }
  .home-nav a {
    display: block; padding: 11px 16px; text-align: center;
    border: 1px solid var(--line); color: var(--ink);
  }
  .home-nav a:hover { border-color: var(--ink); color: var(--ink); }
  .home-nav .contact-link { margin-left: 0; }
  .home-nav .book-link { background: var(--ink); border-color: var(--ink); color: #fff; padding: 11px 16px; }
}

/* ---------- Header: breadcrumb + menu button on mobile ---------- */
.crumb-sep, .crumb-current, .menu-toggle { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }

@media (max-width: 620px) {
  .site-header {
    position: sticky; top: 0; z-index: 40;
    padding: 0; background: #fff; border-bottom: 1px solid var(--line);
  }
  .site-header .wrap { min-height: 56px; padding: 0 16px; gap: 0; }
  .crumbs { flex: 1; overflow: hidden; }
  .crumbs .brand { font-size: 17px; white-space: nowrap; }
  .crumb-sep { display: inline; color: var(--ink-faint); }
  .crumb-current {
    display: inline; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 12px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink); text-decoration: none;
  }
  a.crumb-current { color: var(--ink-faint); }
  a.crumb-current:hover { color: var(--ink); }

  .menu-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; margin-right: -10px; padding: 0 11px;
    background: none; border: 0; cursor: pointer;
  }
  .menu-toggle span { display: block; height: 1.5px; background: var(--ink); transition: transform .2s ease, opacity .2s ease; }
  .is-open .menu-toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .is-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .is-open .menu-toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
  .menu-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }

  .site-header .nav {
    display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0;
    padding: 0 0 16px; font-size: 13px;
  }
  .site-header.is-open .nav { display: flex; }
  .site-header .nav a { padding: 13px 0; border-top: 1px solid var(--line); color: var(--ink-soft); }
  .site-header .nav a[aria-current="page"] { color: var(--ink); text-decoration: none; font-weight: 600; }
  .site-header .nav .book-link { margin-top: 12px; padding: 12px; text-align: center; color: #fff; }

  main { padding-top: 28px; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0 48px; font-size: 14px; color: var(--ink-faint); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { text-decoration: none; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  main { padding-top: 32px; }
  .timeline li, .skills div { grid-template-columns: 1fr; gap: 2px; }
  .list a.row { gap: 12px; }
  .book { grid-template-columns: 64px 1fr; gap: 14px; }
  .cover { width: 64px; font-size: 9px; }
}


/* ---------- Blog posts (rendered by Hugo from content/post/*.md) ---------- */
.post-header { margin-bottom: 32px; }
.post-header h1 { margin-bottom: 0; }

.prose { font-family: var(--reading); font-size: 19px; line-height: 1.7; color: var(--ink-soft); }
.prose > * + * { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote, .prose table { margin: 0 0 22px; }
.prose h2, .prose h3, .prose h4 { font-family: var(--serif); color: var(--ink); line-height: 1.25; margin: 40px 0 14px; }
.prose h2 { font-size: 26px; font-weight: 700; }
.prose h3 { font-size: 21px; }
.prose a { text-decoration: underline; text-decoration-color: #aaa9a1; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0 0 8px; }
.prose blockquote { border-left: 1px solid var(--ink); padding: 2px 0 2px 22px; margin-left: 0; font-style: italic; }
.prose img { display: block; max-width: 100%; height: auto; margin: 32px auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: #f4f4f2; padding: 1px 5px; border-radius: 3px; }
.prose pre { overflow-x: auto; padding: 16px 18px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; line-height: 1.55; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: 16px; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 56px 0 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.post-nav-link { display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.post-nav-link.next { text-align: right; }
.post-nav-link .t { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.post-nav-link:hover .t { text-decoration: underline; }

@media (max-width: 520px) {
  .prose { font-size: 18px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-link.next { text-align: left; }
}

/* ---------- Motion ---------- */
/* Page-to-page: old page fades out, new one fades up (browsers with
   cross-document view transitions; others use the fallback in site.js). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  ::view-transition { background: #fff; }
  ::view-transition-old(root) { animation: 110ms ease-out both page-exit; }
  ::view-transition-new(root) { animation: 200ms 100ms cubic-bezier(.22, .65, .28, 1) both page-enter; }

  @keyframes page-exit { to { opacity: 0; } }
  @keyframes page-enter { from { opacity: 0; transform: translateY(8px); } }
}

/* Mobile home: give the bio its own box so it can rise in (home.js). */
@media (max-width: 620px) {
  .intro-copy .bio { display: block; }
}
