/* ==========================================================================
   Ashish Sethi — Editorial Personal Site
   A warm-paper, serif-forward editorial system with one subtle accent.
   ========================================================================== */

/* ----- Tokens ----------------------------------------------------------- */
:root {
  /* Warm paper palette (defaults; paper tone can be tweaked) */
  --paper:    oklch(0.987 0.007 85);
  --paper-2:  oklch(0.962 0.010 85);
  --paper-3:  oklch(0.935 0.012 84);
  --ink:      oklch(0.235 0.014 64);
  --ink-2:    oklch(0.445 0.012 64);
  --ink-3:    oklch(0.605 0.010 66);
  --line:     oklch(0.875 0.010 84);
  --line-2:   oklch(0.815 0.012 84);

  /* Accent — terracotta by default; Tweaks can override --accent with any color
     and the deep/tint derivations follow automatically. */
  --accent:      oklch(0.565 0.135 44);
  --accent-deep: color-mix(in oklab, var(--accent), black 16%);
  --accent-tint: color-mix(in oklab, var(--accent) 13%, transparent);

  /* Type */
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Rhythm */
  --maxw: 1180px;
  --gutter: clamp(1.25rem, 4.5vw, 4rem);
  --section-pad: clamp(4.5rem, 10vw, 9rem);

  /* Density (tweakable) */
  --density: 1;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Paper-tone variants (Tweaks set data-paper on <html>) */
[data-paper="cool"] {
  --paper:   oklch(0.987 0.006 240);
  --paper-2: oklch(0.961 0.009 240);
  --paper-3: oklch(0.934 0.011 240);
  --ink:     oklch(0.235 0.012 250);
  --ink-2:   oklch(0.445 0.011 250);
  --ink-3:   oklch(0.605 0.009 250);
  --line:    oklch(0.875 0.009 240);
  --line-2:  oklch(0.815 0.011 240);
}
[data-paper="neutral"] {
  --paper:   oklch(0.985 0 0);
  --paper-2: oklch(0.958 0 0);
  --paper-3: oklch(0.930 0 0);
  --ink:     oklch(0.225 0 0);
  --ink-2:   oklch(0.440 0 0);
  --ink-3:   oklch(0.600 0 0);
  --line:    oklch(0.872 0 0);
  --line-2:  oklch(0.810 0 0);
}

/* Photo treatment (Tweaks) */
[data-photo="color"] .plate-frame img { filter: none; }

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--serif);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
}

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

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

/* Mono label utility — the connective tissue of the editorial system */
.label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ----- Layout shell ----------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ----- Top bar ---------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--paper) 82%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  height: 88px;
}
.brand {
  position: relative;
  top: 0.5rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5ch;
}
.topnav { display: flex; gap: clamp(1.1rem, 2.4vw, 2.2rem); }
.topnav a {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
  position: relative;
  padding-block: 0.2rem;
  transition: color 0.25s var(--ease);
}
.topnav a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.topnav a:hover { color: var(--ink); }
.topnav a:hover::after { width: 100%; }
.topnav .cv { color: var(--accent); }

/* ----- Hero ------------------------------------------------------------- */
.hero { padding-top: clamp(3rem, 7vw, 6rem); padding-bottom: var(--section-pad); }

.hero-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
  padding-top: clamp(2.5rem, 6vw, 4rem);
}

.hero-left { padding-top: clamp(2rem, 6vw, 5rem); }

.hero-name {
  font-weight: 400;
  font-size: clamp(3.2rem, 8.5vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: -0.035em;
  margin-bottom: clamp(1.4rem, 3vw, 2rem);
}
.hero-name .ln { display: block; }
.hero-name .ln-2 { font-style: italic; font-weight: 300; padding-left: 0.04em; }

.hero-lead {
  font-size: clamp(1.15rem, 1.7vw, 1.45rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 34ch;
  margin-bottom: 2rem;
  text-wrap: pretty;
}
.hero-lead strong { color: var(--ink); font-weight: 600; }

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.6rem;
}
.social a {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  transition: color 0.22s var(--ease);
}
.social a .arr { color: var(--ink-3); transition: transform 0.25s var(--ease), color 0.22s var(--ease); }
.social a:hover { color: var(--accent); }
.social a:hover .arr { transform: translate(2px, -2px); color: var(--accent); }

/* Portrait — magazine plate treatment */
.plate { position: relative; }
.plate-frame {
  position: relative;
  border: 1px solid var(--line-2);
  padding: 10px;
  background: var(--paper-2);
}
.plate-frame img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 28%;
  filter: grayscale(100%) contrast(1.03);
  transition: filter 0.6s var(--ease);
}
.plate-frame:hover img { filter: grayscale(0%) contrast(1); }
.plate-cap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.7rem;
}
.plate-cap span { color: var(--ink-3); }

/* ----- Section scaffolding --------------------------------------------- */
.section { padding-block: var(--section-pad); }
.section.alt { background: var(--paper-2); border-block: 1px solid var(--line); }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  margin-bottom: clamp(2.2rem, 5vw, 3.6rem);
}
.sec-num { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); letter-spacing: 0.1em; }
.sec-title {
  font-weight: 400;
  font-size: clamp(1.7rem, 3.6vw, 2.8rem);
  letter-spacing: -0.02em;
  line-height: 1;
}
.sec-title em { font-style: italic; font-weight: 300; color: var(--ink-2); }
.sec-line { flex: 1; height: 1px; background: var(--line); align-self: center; }

/* ----- Background / timeline ------------------------------------------- */
.timeline { display: flex; flex-direction: column; }
.tl-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr auto;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: baseline;
  padding-block: calc(1.5rem * var(--density));
  border-top: 1px solid var(--line);
  transition: background 0.3s var(--ease);
}
.tl-row:last-child { border-bottom: 1px solid var(--line); }
.tl-year { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-3); letter-spacing: 0.04em; padding-top: 0.35rem; }
.tl-main { display: flex; flex-direction: column; gap: 0.25rem; }
.tl-role { font-size: clamp(1.25rem, 2.4vw, 1.7rem); font-weight: 400; letter-spacing: -0.015em; }
.tl-org { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); letter-spacing: 0.02em; }
.tl-kind {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 0.25em 0.85em;
  white-space: nowrap;
  align-self: center;
}
.tl-row:hover .tl-role { color: var(--accent-deep); }

/* ----- Projects / index list ------------------------------------------- */
.work { border-top: 1px solid var(--line); }
.work-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2.5rem;
  gap: clamp(0.8rem, 2.5vw, 2rem);
  align-items: center;
  padding-block: calc(1.7rem * var(--density));
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: padding 0.35s var(--ease);
}
.work-row::before {
  content: '';
  position: absolute;
  inset: 0 calc(-1 * var(--gutter));
  background: var(--accent-tint);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  z-index: -1;
}
.work-row:hover::before { opacity: 1; }
.work-row:hover { padding-inline: clamp(0.5rem, 1.5vw, 1.2rem); }

.work-idx {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-3);
  letter-spacing: 0.05em;
  transition: color 0.25s var(--ease);
}
.work-row:hover .work-idx { color: var(--accent); }

.work-body { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.work-title {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  transition: color 0.25s var(--ease);
}
.work-row:hover .work-title { color: var(--accent-deep); }
.work-desc { color: var(--ink-2); font-size: clamp(0.98rem, 1.4vw, 1.12rem); line-height: 1.5; max-width: 52ch; text-wrap: pretty; }

.work-tags { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; }
.tag {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.tag::before { content: '·'; margin-right: 0.5ch; color: var(--line-2); }
.tag:first-child::before { display: none; }

.work-arrow {
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--ink-3);
  justify-self: end;
  transition: transform 0.3s var(--ease), color 0.25s var(--ease);
}
.work-row:hover .work-arrow { color: var(--accent); transform: translateX(5px); }

/* ----- Writing ---------------------------------------------------------- */
.writing { display: flex; flex-direction: column; }
.write-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr 2.5rem;
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: baseline;
  padding-block: calc(1.6rem * var(--density));
  border-top: 1px solid var(--line);
  transition: background 0.3s var(--ease);
}
.writing .write-row:last-of-type { border-bottom: 1px solid var(--line); }
.write-date { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-3); padding-top: 0.3rem; letter-spacing: 0.03em; }
.write-main { display: flex; flex-direction: column; gap: 0.5rem; }
.write-title { font-size: clamp(1.3rem, 2.6vw, 1.85rem); font-weight: 400; letter-spacing: -0.015em; line-height: 1.12; transition: color 0.25s var(--ease); }
.write-row:hover .write-title { color: var(--accent-deep); }
.write-excerpt { color: var(--ink-2); font-size: 1.02rem; line-height: 1.5; max-width: 58ch; text-wrap: pretty; }
.write-cats { display: flex; gap: 0.5rem 0.6rem; flex-wrap: wrap; margin-top: 0.2rem; }
.write-arrow { font-family: var(--mono); color: var(--ink-3); justify-self: end; transition: transform 0.3s var(--ease), color 0.25s var(--ease); }
.write-row:hover .write-arrow { color: var(--accent); transform: translateX(5px); }

.writing-note {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin-top: 1.6rem;
}

/* ----- Contact / footer ------------------------------------------------- */
.contact { padding-block: var(--section-pad); }
.contact-eyebrow { margin-bottom: clamp(1.4rem, 3vw, 2.2rem); }
.contact-line {
  font-weight: 400;
  font-size: clamp(2.2rem, 6.5vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: clamp(2rem, 5vw, 3.4rem);
  text-wrap: balance;
}
.contact-line em { font-style: italic; font-weight: 300; }
.contact-mail {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6ch;
  font-size: clamp(1.3rem, 3vw, 2rem);
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 0.15em;
  transition: border-color 0.3s var(--ease), color 0.25s var(--ease);
}
.contact-mail .arr { font-family: var(--mono); font-size: 0.7em; color: var(--accent); transition: transform 0.3s var(--ease); }
.contact-mail:hover { color: var(--accent-deep); border-color: var(--accent); }
.contact-mail:hover .arr { transform: translate(3px, -3px); }

.foot {
  margin-top: var(--section-pad);
  padding-block: 2.2rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 2rem;
}
.foot-social { display: flex; gap: 1.4rem; }
.foot-social a, .foot-copy {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}
.foot-social a { transition: color 0.22s var(--ease); }
.foot-social a:hover { color: var(--accent); }
.foot-copy { color: var(--ink-3); }

/* ----- Motion: reveal on scroll ---------------------------------------- */
/* Pure-CSS scroll-driven reveal. Content is visible by default; where the
   browser supports scroll timelines, each element rises/fades in as it enters
   the viewport. No JS, no timers — it can never get stuck hidden, and degrades
   gracefully to fully-visible everywhere else. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    [data-reveal] {
      animation: revealUp linear both;
      animation-timeline: view();
      animation-range: entry 2% cover 16%;
    }
  }
}
@keyframes revealUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   Inner pages — blog index, articles, projects (editorial aesthetic)
   ========================================================================== */

/* Page shell: clears the sticky topbar and frames the standalone footer */
.page { padding-top: clamp(6rem, 12vw, 11rem); }
.page > .section:first-child { padding-top: clamp(6rem, 12vw, 11rem); }

/* Standalone footer (inner pages) */
.site-foot { background: var(--paper-2); border-top: 1px solid var(--line); margin-top: var(--section-pad); }
.site-foot .foot { margin-top: 0; border-top: 0; }

/* ----- Article ---------------------------------------------------------- */
.post.wrap { max-width: 760px; padding-top: clamp(6rem, 12vw, 11rem); padding-bottom: var(--section-pad); }

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  color: var(--ink-2);
  transition: color 0.22s var(--ease);
}
.post-back:hover { color: var(--accent); }

.post-header { margin: 1.6rem 0 clamp(2.2rem, 5vw, 3.4rem); }
.post-header .post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  margin-bottom: 1.2rem;
}
.post-cats { display: inline-flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; }
.post-title {
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.post-lead {
  margin-top: 1.1rem;
  font-size: clamp(1.12rem, 1.8vw, 1.4rem);
  line-height: 1.5;
  color: var(--ink-2);
  font-style: italic;
  font-weight: 300;
  max-width: 46ch;
  text-wrap: pretty;
}

/* ----- Article prose ---------------------------------------------------- */
.post-content {
  font-size: 1.12rem;
  line-height: 1.72;
  color: var(--ink);
}
.post-content > * + * { margin-top: 1.35em; }
.post-content h2,
.post-content h3,
.post-content h4 {
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-top: 2.4em;
}
.post-content h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.post-content h3 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); }
.post-content h4 { font-size: 1.18rem; color: var(--ink-2); }
.post-content p { text-wrap: pretty; }
.post-content a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-color: var(--accent-tint);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.22s var(--ease);
}
.post-content a:hover { text-decoration-color: var(--accent); }
.post-content strong { font-weight: 600; }
.post-content em { font-style: italic; }
.post-content ul,
.post-content ol { padding-left: 1.4em; }
.post-content li + li { margin-top: 0.45em; }
.post-content li { padding-left: 0.2em; }
.post-content ul li::marker { color: var(--accent); }
.post-content ol li::marker { color: var(--ink-3); font-family: var(--mono); font-size: 0.85em; }
.post-content blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.2em 0 0.2em 1.3em;
  color: var(--ink-2);
  font-style: italic;
}
.post-content img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line-2);
  background: var(--paper-2);
  padding: 8px;
  margin-inline: auto;
}
.post-content code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--paper-3);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}
.post-content pre {
  background: var(--ink);
  color: var(--paper);
  padding: 1.1rem 1.3rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}
.post-content pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.post-content hr { height: 1px; border: 0; background: var(--line); margin-block: 2.4em; }
.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.post-content th,
.post-content td { border: 1px solid var(--line); padding: 0.55em 0.8em; text-align: left; }
.post-content th { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); background: var(--paper-2); }

.post-foot { margin-top: clamp(2.6rem, 6vw, 4rem); padding-top: 1.8rem; border-top: 1px solid var(--line); }

/* ----- Responsive ------------------------------------------------------- */
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.6rem; align-items: start; }
  .plate { max-width: 360px; }
  .work-row { grid-template-columns: 2.6rem 1fr 2rem; }
  .work-tags { margin-top: 0.1rem; }
}
@media (max-width: 620px) {
  .topnav { gap: 1rem; }
  .topnav a.hide-sm { display: none; }
  .tl-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .tl-year { padding-top: 0; }
  .tl-kind { display: none; }
  .write-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .write-arrow { display: none; }
  .hero-name { font-size: clamp(3rem, 18vw, 5rem); }
}
