/* ========== Developer stories index ========== */

:root {
	--newsroom-surface: #f5f5f7;
	--newsroom-tile-bg: #fff;
	--newsroom-secondary: #6e6e73;
	--newsroom-hairline: #d2d2d7;

	/* Tile component tokens, consumed by global.dist.css. The padding and gap
	   are set on .tile-content directly instead — see the Copy box section. */
	--sk-tile-border-radius: 16px;
}

body[data-color-scheme="light"] {
	--bg-light-override: var(--newsroom-surface);
	--bg-fill: var(--newsroom-surface);
}

body[data-color-scheme="dark"] {
	--newsroom-surface: #1d1d1f;
	--newsroom-tile-bg: #000;
	--newsroom-secondary: #a1a1a6;
	--newsroom-hairline: #424245;

	--bg-light-override: var(--newsroom-surface);
	--bg-fill: var(--newsroom-surface);
}

/* The reference home is one flat surface. Light mode already resolved flat;
   this is the dark <main> gradient, which the old sheet still painted. Delete
   this rule to get the gradient back. */
.bg-light-alt,
body[data-color-scheme="dark"] main.bg-light-alt {
	background: var(--newsroom-surface);
}

.bg-fill {
	background-color: var(--newsroom-surface);
}

#main section.section {
	padding-top: 4rem;
	padding-bottom: 4rem;
	background-color: var(--newsroom-surface);
}

/* The year headings sit in .row > .column, a different grid system than the
   cards; zeroing its gutters is what lines the two up. */
#main section .section-content .row {
	margin-left: 0;
	margin-right: 0;
}

#main section .section-content .row > .column {
	padding: 0;
}

/* ========== Year headings ==========
   .divider-top already supplies the rule and .padding-top-small /
   .margin-top-small the spacing — both are on the h2. Only the color and the
   type change: hairline token, typography-eyebrow. */

#main h2.divider-top {
	border-color: var(--newsroom-hairline);
	font-family: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
	font-size: 24px;
	line-height: 1.16667;
	font-weight: 600;
	letter-spacing: 0.009em;
	margin-bottom: 0;
}

/* Replaces the old #ddd divider, which predates the hairline token. */
body[data-color-scheme="dark"] .divider-top,
.theme-dark .divider-top {
	border-color: var(--newsroom-hairline);
}

/* ========== Grid ==========
   40 / 36, the reference's gap. .grid-gutterless already drops the outer
   padding, so the first card stays flush with the heading above it. */

#main .grid.grid-gutterless {
	--sk-cssgrid-column-gutter-inner: 36px;
	--sk-cssgrid-row-gutter-inner: 40px;
}

/* ========== Tiles ========== */

/* .tile-link is already display:block;height:100% and .tile-full already
   flexes the content column, so the card itself only needs its fill. */
#main .tile-link .tile {
	--sk-tile-background: var(--newsroom-tile-bg);
}

/* The whole card is the link, so hovering it must not underline the copy. */
#main .tile-link,
#main .tile-link:hover {
	text-decoration: none;
}

#main .card-media {
	/* Replaces the old max-height crop — aspect-ratio on the img does the same
	   job at every width, so the three breakpoint heights are gone. */
	overflow: hidden;
	max-height: none;
}

#main .card-media img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	transition: transform 0.4s;
}

/* ---- Copy box ----
   .nr-tile-description's box, declared outright rather than through
   --sk-tile-padding / --tile-custom-gap. Those tokens were being shadowed and
   the card fell back to global's 60px 8.3333% default, which is where the slack
   above the headline came from. 0-1-1 plus #main beats .tile-content's own
   padding rule, so the values here are what ship.

   display: contents on the include's wrapper div is what makes this work
   without touching the markup: it collapses, so the h5 and the summary become
   direct flex items of .tile-content and the gap applies to them, exactly as
   .nr-tile-description > :where(p, h3) does in the reference. */
#main .tile-link .tile-content {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: flex-start;
	gap: 0.5rem;
	padding: 1.5rem;
}

#main .tile-link .tile-content > div {
	display: contents;
}

#main .tile-content h5 {
	font-family: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
	font-size: 19px;
	line-height: 1.2105;
	font-weight: 600;
	letter-spacing: 0.012em;
	margin: 0;
}

/* The reference tile is eyebrow + headline + date — no summary. The includes
   still emit one, so it's hidden here rather than stripped from 132 files.
   The date line is exempt by class, not by position. */
#main .tile-content p:not(.tile-date) {
	display: none;
}

/* .newsroom-date's treatment: typography-body-reduced, semibold, secondary.
   margin-top: auto drops it to the card's baseline so dates line up across a
   row whatever the headline length — the reference's
   .nr-tile-description > .newsroom-date, including its 0.25rem lead-in. That
   padding has to be !important to beat the include's padding-top-small. */
#main .tile-content p.tile-date {
	margin: auto 0 0;
	padding-top: 0.25rem !important;
	color: var(--newsroom-secondary);
	font-size: 14px;
	line-height: 1.42859;
	font-weight: 600;
	letter-spacing: -0.016em;
}

/* ========== Hero ==========
   The newest story leads the page full width, the way Latest News does in the
   reference. The span itself comes from the markup — that grid-item is the
   page's only .large-span-12, so it doubles as the hook for the layout below. */

@media only screen and (min-width: 735px) {
	#main .grid-item.large-span-12 .tile-full {
		flex-direction: row;
	}

	/* 643/980 at L and 453/692 at M are both 65.5%, so one basis covers both.
	   min-width: 0 is required — a flex item's auto minimum is its intrinsic
	   size, so the 2048px source would otherwise ignore the basis and squeeze
	   the copy column to nothing. */
	#main .grid-item.large-span-12 .card-media {
		flex: 0 0 65.5%;
		min-width: 0;
	}

	/* Fills the taller of image and copy, rather than letting 16/9 leave a gap
	   under a long headline. */
	#main .grid-item.large-span-12 .card-media img {
		height: 100%;
	}

	#main .grid-item.large-span-12 .tile-content {
		padding: 2rem;
	}

	#main .grid-item.large-span-12 h5 {
		font-size: 32px;
		line-height: 1.125;
		font-weight: 700;
		letter-spacing: 0.004em;
	}
}

/* ========== Hover ==========
   Pointer widths only, matching the reference. */

@media only screen and (min-width: 1069px) {
	#main .tile-link:hover .card-media img {
		transform: scale(1.02);
	}
}

/* ========== Medium ========== */

@media only screen and (max-width: 1068px) {
	#main .tile-link .tile-content {
		padding: 1.25rem;
	}

	#main .grid.grid-gutterless {
		--sk-cssgrid-column-gutter-inner: 24px;
		--sk-cssgrid-row-gutter-inner: 32px;
	}

	#main h2.divider-top {
		font-size: 21px;
	}

	#main .grid-item.large-span-12 h5 {
		font-size: 24px;
		line-height: 1.16667;
		letter-spacing: 0.009em;
	}
}

/* ========== Small ========== */

@media only screen and (max-width: 734px) {
	#main section.section {
		padding-top: 3rem;
		padding-bottom: 3rem;
	}

	#main .grid.grid-gutterless {
		--sk-cssgrid-row-gutter-inner: 24px;
	}

	/* .small-span-12 already puts every card on its own row, so the hero stacks
	   and reads as an ordinary tile. */
	#main .grid-item.large-span-12 h5 {
		font-size: 19px;
		line-height: 1.2105;
		font-weight: 600;
		letter-spacing: 0.012em;
	}
}

/* ========== Light + dark mode images ==========
   Carried over unchanged. No include uses it today, but it's the page's
   contract for any card that ships a paired asset. */

img.dark-image,
img.light-image {
	display: none;
}

body[data-color-scheme="dark"] img.dark-image,
body[data-color-scheme="light"] img.light-image {
	display: block;
}

body[data-color-scheme="dark"] img.light-image,
body[data-color-scheme="light"] img.dark-image {
	display: none;
}
