/* Homepage — editorial, artifact-led. Scoped to .home so the rest of the site is untouched. */

.home {
    /* structure, ink and paper now live in index.css :root. the homepage adds only
       what is its own: the tile wash, its column width and its display faces. */

    /* one wash, the tile surface in the archive strip, in the accent's own family */
    --sky: #dce8f4;
    --fig-blue: var(--accent);

    --wide: 74rem;
    --font-display: "Outfit", var(--font-family);

    color: var(--ink);
    background: var(--paper);
    font-family: var(--font-family);
}

:root.dark-mode .home {
    --sky: #182430;
}

/* The home page opts out of the 45em article column. */
body:has(.home) .main-content {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* the global a[href]:visited rule outranks a bare .home a, so match its specificity */
.home a[href],
.home a[href]:visited {
    color: inherit;
}

.home-section {
    width: 100%;
    padding: 0 var(--gutter);
}

.home-inner {
    max-width: var(--wide);
    margin: 0 auto;
    padding: clamp(3.5rem, 8vh, 6rem) 0;
    border-top: 1px solid var(--line-soft);
}

.hero .home-inner { border-top: 0; }

.home h1,
.home h2,
.home h3 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.08;
    margin: 0;
    text-wrap: balance;
}

.eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0;
}

/* a short hairline used as an opening beat */
.rule {
    display: block;
    width: 3.5rem;
    height: 1px;
    background: var(--line);
}

/* ---------- section furniture: hanging number, eyebrow, optional right-hand cue ---------- */

/* the number hangs out into the gutter so the eyebrow lines up with the content column */
.section-head {
    position: relative;
    margin: 0 0 1.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.section-num {
    position: absolute;
    left: -2.5rem;
    font-variant-numeric: tabular-nums;
}

/* the number has nowhere to hang once the gutter closes up */
@media (max-width: 1220px) {
    .section-num { position: static; margin-right: 1.25rem; }
}

/* headline left, "explore more" right, sharing a baseline */
.section-lead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.section-lead--tight { margin-bottom: 1.75rem; }
.section-lead--tight .section-head { margin-bottom: 0; }

.section-cue {
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--line);
    transition: border-color 0.4s ease;
}

.section-cue:hover,
.section-cue:focus-visible { border-color: var(--ink); }

/* ---------- 1. Hero ---------- */

.hero .home-inner {
    padding-top: clamp(3rem, 9vh, 6rem);
    padding-bottom: clamp(4rem, 11vh, 8rem);
}

/* text left, portrait right. the portrait is the tallest thing here: two elements of
   equal weight side by side read as unresolved, so one has to lead. */
.hero-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(14rem, 30%, 19rem);
    gap: clamp(2.5rem, 8vw, 6rem);
    align-items: center;
}

/* no border, no radius: chrome makes a photograph read as an avatar component */
.hero-portrait {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    object-position: 50% 20%;
    display: block;
}

@media (max-width: 800px) {
    .hero-split { grid-template-columns: minmax(0, 1fr); }
    .hero-portrait { max-width: 17rem; }
}

.hero-text .rule { margin-bottom: 1.75rem; }

/* the name is the headline now, so it carries the weight the tagline used to */
.hero-title {
    font-size: clamp(2.75rem, 7vw, 5rem);
    letter-spacing: -0.035em;
    line-height: 0.95;
    margin: 0.85rem 0 0;
    /* 16ch clears "Himanshu Mittal" on one line at every desktop size, and still
       lets it wrap once the column itself gets narrower than the name. */
    max-width: 16ch;
}

.hero-lede {
    max-width: 27rem;
    margin: 2rem 0 0;
    font-size: clamp(1rem, 1.2vw, 1.0625rem);
    line-height: 1.65;
    color: var(--ink-soft);
}

.hero-social {
    display: flex;
    gap: 1.5rem;
    margin-top: 2rem;
    font-size: 1.0625rem;
}

.hero-social a {
    color: var(--ink-faint);
    text-decoration: none;
    transition: color 0.3s ease;
}

.hero-social a:hover,
.hero-social a:focus-visible { color: var(--ink); }

/* ---------- 2. Featured writings ---------- */

.featured-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 2rem;
}

@media (max-width: 800px) {
    .featured-grid { grid-template-columns: minmax(0, 1fr); }
}

/* the tint is the card. no border, no glass, no shadow — a plate of colour with
   type on it, so a real screenshot can bleed into the right half later. */
.story {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    min-height: clamp(14rem, 24vh, 17rem);
    background: var(--paper-2);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: filter 0.4s ease, transform 0.4s ease;
}

.story:has(.story-media) { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }

.story-text {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: clamp(1.5rem, 2.6vw, 2.25rem);
}

/* The two cards are one surface, not two colours. A warm card next to a cool one
   asks the reader to find a difference that is not there, and at this size the wash
   competed with the archive tiles below, where the colour is doing real work as a
   stand-in for a missing thumbnail. Hierarchy here comes from scale and the serif. */
.story {
    border: 1px solid var(--line-soft);
    transition: border-color 0.35s ease, background-color 0.35s ease;
}

.story:hover,
.story:focus-visible { border-color: var(--ink); }

@media (prefers-reduced-motion: no-preference) {
    a.story:hover { transform: translateY(-3px); }
}

a.story:hover,
a.story:focus-visible { filter: brightness(0.98); }

.story-media { overflow: hidden; }
.story-media img { display: block; width: 100%; height: 100%; object-fit: cover; }

.story-project {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--ink) 55%, transparent);
}

/* serif here: these are headlines from written pieces, not interface labels */
.home .story-headline {
    font-family: var(--font-serif);
    font-weight: 400;
    letter-spacing: -0.005em;
    font-size: clamp(1.25rem, 2.1vw, 1.75rem);
    line-height: 1.2;
    margin: 0.25rem 0 0;
    max-width: 20ch;
    color: var(--ink);
}

.story-meta {
    margin: auto 0 0;
    padding-top: 1.5rem;
    font-size: 0.875rem;
    color: color-mix(in srgb, var(--ink) 62%, transparent);
}

.story-cue {
    font-size: 0.875rem;
    font-weight: 500;
}

.story-cue--pending {
    color: color-mix(in srgb, var(--ink) 55%, transparent);
    font-weight: 400;
}

/* ---------- 3. Where the work is pointed now ---------- */

/* the question on the left, the argument on the right */
.now-split {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
}

@media (max-width: 900px) {
    .now-split { grid-template-columns: minmax(0, 1fr); }
}

/* the diagram fills the column under the claim; on narrow screens the split collapses
   and it simply sits between the claim and the prose */
.now-figure {
    margin: clamp(2rem, 5vh, 3.25rem) 0 0;
    max-width: 26rem;
}

.now-figure svg { display: block; width: 100%; height: auto; overflow: visible; }

.now-figure path { fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* axes and arrowheads recede; the two curves are the content */
.fig-axis path { stroke: var(--ink-faint); stroke-width: 1; }
.fig-axis path:not(:first-child) { fill: var(--ink-faint); stroke: none; }

.fig-ai { stroke: var(--ink); stroke-width: 2; }
.fig-human { stroke: var(--fig-blue); stroke-width: 2; }

.fig-gap path { stroke: var(--ink-faint); stroke-width: 1; }
.fig-gap path:not(:first-child) { fill: var(--ink-faint); stroke: none; }

.now-figure text {
    font-family: var(--font-family);
    font-size: 11px;
    fill: var(--ink-soft);
}

.now-figure .fig-label { font-size: 12px; fill: var(--ink); }
.now-figure .fig-label--human { fill: var(--fig-blue); }

.now-figure .fig-note,
.now-figure .fig-axis-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    fill: var(--ink-faint);
}
.now-figure figcaption {
    margin-top: 1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--ink-faint);
    text-align: center;
    text-wrap: pretty;
}

/* every --h-section headline on the site is set in the serif: this one, the archive
   and writing titles, and the h1 on a post. one face for one level. */
.home .now-title {
    font-family: var(--font-serif);
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.15;
    font-size: var(--h-section);
    max-width: 16ch;
    margin: 0;
}

.now-body {
    display: grid;
    gap: 1.15rem;
    max-width: 36rem;
}

.now-body p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--ink-soft);
    text-wrap: pretty;
}

/* said once, quietly, and not asking the reader for anything */
.now-body .now-close {
    margin-top: 0.5rem;
    color: var(--ink);
}

/* ---------- 4. Breadth — six tiles, the rest at /archive/ ---------- */

/* the second register inside section 03: same column, quieter, and set far enough
   below the cards that it reads as a change of scale rather than a new section */
.breadth { margin-top: clamp(3.5rem, 8vh, 5.5rem); }

.sub-head {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.section-lead--sub { margin-bottom: 1.5rem; }

.scraps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

/* narrow: one strip that scrolls sideways. the cut-off card is the affordance,
   so the cards keep a fixed width instead of wrapping into a second row. */
@media (max-width: 1000px) {
    .scraps {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: clamp(10rem, 58vw, 14rem);
        overflow-x: auto;
        scroll-snap-type: x proximity;
        padding-bottom: 0.5rem;
    }
    .scrap { scroll-snap-align: start; }
}

.scrap-face {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    width: 100%;
    padding: 0;
    background: none;
    border: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    height: 100%;
}

/* the plate stands in for the artwork: the descriptor is the image, so the
   descriptor sets the height. flex:1 keeps every plate in the row level. */
.scrap-plate {
    display: flex;
    align-items: flex-end;
    flex: 1;
    min-height: 5rem;
    padding: 0.75rem;
    background: var(--paper-2);
    border: 1px solid var(--line-soft);
    transition: background-color 0.35s ease, border-color 0.35s ease;
}

.scrap-plate .desc {
    font-size: 0.875rem;
    line-height: 1.35;
    color: var(--ink-soft);
    text-wrap: pretty;
}

.scrap-face .title {
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--ink);
}

.scrap-face .year {
    font-size: 0.75rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

/* the wash is what the thumbnail used to be. one wash, not a cycle of four: the
   colour was assigned by position in the row, so a reader looking for why this tile
   is green and that one gold finds nothing. one hue makes them read as a set. */
.scrap .scrap-plate { background: var(--sky); }

.scrap-face:hover .scrap-plate { border-color: var(--ink); }
.scrap-face:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Without popover support the div has no UA display:none, so all five annotations
   would render inline in the page. Hide them and leave the tiles as plain labels. */
@supports not selector(:popover-open) {
    .scrap-pop { display: none; }
}

/* the annotation. native popover, so it escapes the grid, and handles keyboard,
   touch and light-dismiss without a line of JS. */
.scrap-pop {
    max-width: 30rem;
    padding: 1.5rem 1.6rem;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--paper-2);
    color: var(--ink);
    box-shadow: 0 24px 70px rgba(30, 34, 50, 0.18);
}

:root.dark-mode .scrap-pop { box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5); }
.scrap-pop::backdrop { background: rgba(20, 20, 25, 0.28); }

.scrap-pop .pop-head {
    margin: 0 0 0.9rem;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.scrap-pop .pop-head span { float: right; text-transform: none; letter-spacing: 0; }

.scrap-pop p {
    margin: 0 0 0.8rem;
    font-size: 0.9375rem;
    line-height: 1.62;
    color: var(--ink-soft);
}

.scrap-pop a {
    margin-right: 1.1rem;
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.8125rem;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

.scrap-pop a:hover { border-color: var(--ink); }

/* ---------- /archive/ — the same furniture, one long column ---------- */

.home .archive-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(1.625rem, 3.2vw, 2.375rem);
    line-height: 1.25;
    max-width: 30ch;
    margin: 0 0 clamp(3rem, 7vh, 4.5rem);
}

.archive-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.archive-item {
    display: grid;
    grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.4fr);
    gap: clamp(1.5rem, 4vw, 4rem);
    padding: clamp(1.75rem, 3.5vh, 2.5rem) 0;
    border-top: 1px solid var(--line-soft);
}

@media (max-width: 800px) {
    .archive-item { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
}

.archive-name {
    font-size: clamp(1.0625rem, 1.8vw, 1.375rem);
    line-height: 1.25;
    margin: 0;
}

.archive-year {
    margin: 0.4rem 0 0;
    font-size: 0.8125rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

.archive-desc {
    margin: 0 0 1rem;
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.archive-body p {
    margin: 0 0 0.8rem;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--ink-soft);
    text-wrap: pretty;
}

.archive-link {
    margin-right: 1.1rem;
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

.archive-link:hover { border-color: var(--ink); }

.archive-page .section-cue { margin-top: clamp(2.5rem, 6vh, 4rem); display: inline-block; }
