/* ==========================================================================
   Mayur Kamat — "The Masthead"
   Editorial single-page site. Hand-authored, no framework.
   ========================================================================== */

:root {
  --paper: #F6F3EC;
  --ink: #1C1A16;
  --ink-soft: #5C574D;
  --rule: #D8D2C4;
  --acc-retire: #0E6E5C;
  --acc-myth: #5B3FA8;
  --acc-fam: #C74E33;
  --max: 1080px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Scroll anchoring chases the .reveal translateY transition and cancels
   smooth anchor scrolls mid-flight (Chromium). Reveals never shift layout,
   so anchoring buys nothing here. */
html { overflow-anchor: none; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* no overflow rule here: it propagates to the viewport and breaks window scroll / anchor jumps */
}

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

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

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}

/* Focus visibility ------------------------------------------------------ */

a:focus-visible,
button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Masthead --------------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  position: relative;
  z-index: 10;
  background: var(--paper);
}

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 18px;
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.masthead .m-left { color: var(--ink); font-weight: 500; }
.masthead .m-center { flex: 1; text-align: center; }
.masthead .m-right { text-align: right; white-space: nowrap; }

@media (max-width: 640px) {
  .masthead .m-center { display: none; }
}

/* Hero -------------------------------------------------------------------- */

.hero {
  padding-top: 18vh;
  padding-bottom: 10vh;
}

.hero .eyebrow {
  display: block;
  margin-bottom: 28px;
}

.eyebrow {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.hero h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: clamp(3.2rem, 9vw, 7.5rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0;
}

.hero h1 span.line { display: block; }

.hero .underline-em {
  position: relative;
  font-style: italic;
  font-weight: 560;
  white-space: nowrap;
}

.hero .underline-em svg {
  position: absolute;
  left: -2%;
  bottom: -0.06em;
  width: 104%;
  height: 0.3em;
  overflow: visible;
}

.hero .underline-em svg path {
  stroke: var(--acc-fam);
  stroke-width: 4;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
}

@media (prefers-reduced-motion: no-preference) {
  .hero .underline-em svg path.draw {
    animation: draw-underline 900ms ease-out 300ms forwards;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero .underline-em svg path { stroke-dashoffset: 0; }
}

@keyframes draw-underline {
  to { stroke-dashoffset: 0; }
}

.hero .sub {
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 28px 0 36px;
}

.hero .jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.hero .jumps a {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: border-color 150ms, text-decoration-thickness 150ms;
}

.hero .jumps a:hover,
.hero .jumps a:focus-visible {
  border-bottom-color: currentColor;
}

.hero .jumps a.j-retire { color: var(--acc-retire); }
.hero .jumps a.j-myth { color: var(--acc-myth); }
.hero .jumps a.j-fam { color: var(--acc-fam); }

/* Reveal-on-scroll --------------------------------------------------------- */

.reveal {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  /* Opacity-only on purpose: a translateY transition here makes Chromium
     cancel smooth anchor scrolls mid-flight (jump links stop short). */
  .reveal {
    opacity: 0;
    transition: opacity 700ms ease-out;
  }
  .reveal.in {
    opacity: 1;
  }
  /* Set by script.js when a jump link is clicked (see comment there). */
  .no-reveal-anim .reveal {
    transition: none;
  }
}

/* Project blocks ------------------------------------------------------------ */

.project {
  border-top: 1px solid var(--rule);
  padding: 72px 0;
  position: relative;
  overflow: hidden; /* contain the decorative motifs (the only horizontal-overflow source) */
}

.project .grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  align-items: start;
}

.project .col-name {
  grid-column: 1 / span 7;
  position: relative;
}

.project .col-details {
  grid-column: 8 / span 5;
}

.project.mirror .col-name {
  grid-column: 6 / span 7;
  order: 2;
}

.project.mirror .col-details {
  grid-column: 1 / span 5;
  grid-row: 1;
  order: 1;
}

@media (max-width: 860px) {
  .project .grid {
    display: block;
  }
  .project .col-name,
  .project .col-details,
  .project.mirror .col-name,
  .project.mirror .col-details {
    grid-column: auto;
    order: initial;
  }
  .project .col-details { margin-top: 28px; }
}

.project .motif {
  position: absolute;
  top: -20px;
  left: -20px;
  width: 120%;
  max-width: 620px;
  height: auto;
  z-index: 0;
  pointer-events: none;
}

.project.mirror .motif {
  left: auto;
  right: -20px;
}

@media (max-width: 860px) {
  .project .motif { display: none; }
}

.project .index {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.project .name {
  position: relative;
  z-index: 1;
  display: inline-block;
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 150ms;
}

.project .name:hover,
.project .name:focus-visible {
  border-bottom-color: currentColor;
}

.project .kicker {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 20px 0 16px;
  display: block;
}

.project .pitch {
  font-size: 1.05rem;
  margin: 0 0 24px;
  max-width: 46ch;
}

.project .details {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
}

.project .details li {
  margin-bottom: 12px;
  max-width: 42ch;
}

.project .details .lead {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  font-weight: 500;
  margin-right: 6px;
}

.project .link-line {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: border-color 150ms;
}

.project .link-line:hover,
.project .link-line:focus-visible {
  border-bottom-color: currentColor;
}

.project.retire .index,
.project.retire .link-line,
.project.retire .name { color: var(--acc-retire); }
.project.retire .index { color: var(--ink-soft); }

.project.myth .name,
.project.myth .link-line { color: var(--acc-myth); }

.project.fam .name,
.project.fam .link-line { color: var(--acc-fam); }

/* Timeline ------------------------------------------------------------------ */

.timeline {
  border-top: 1px solid var(--rule);
  padding: 72px 0;
}

.timeline h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 16px 0 24px;
  max-width: 20ch;
}

.timeline p {
  max-width: 60ch;
  color: var(--ink);
  margin: 0 0 32px;
}

.timeline .companies {
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 2;
  word-spacing: 2px;
}

/* Off hours ------------------------------------------------------------------ */

.off-hours {
  border-top: 1px solid var(--rule);
  padding: 48px 0;
}

.off-hours .eyebrow { margin-bottom: 20px; display: block; }

.off-hours .rows {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 40px;
}
@media (max-width: 860px) {
  .off-hours .rows { grid-template-columns: 1fr; }
}

.off-hours .rows p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.off-hours .rows .lead {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  font-weight: 500;
  color: var(--ink);
  margin-right: 4px;
}

@media (max-width: 640px) {
  .off-hours .rows {
    flex-direction: column;
    gap: 16px;
  }
}

/* Footer ----------------------------------------------------------------- */

footer.site-footer {
  border-top: 1px solid var(--rule);
  padding: 48px 0 40px;
}

footer.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

footer.site-footer .say-hello {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 12px;
}

footer.site-footer .say-hello a {
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 0.55em;
  letter-spacing: 0.04em;
  color: var(--acc-retire);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 150ms;
  vertical-align: middle;
  margin-left: 12px;
}

footer.site-footer .say-hello a:hover,
footer.site-footer .say-hello a:focus-visible {
  border-bottom-color: currentColor;
}

footer.site-footer .meta {
  text-align: right;
  color: var(--ink-soft);
  font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 1.8;
}

footer.site-footer .build-id {
  display: block;
  color: var(--ink-soft);
}
