/* Redline: Tahan Bapna portfolio
   Colors and fonts live in :root. Change them here and the whole page follows. */

:root {
  --paper: #F6F3EC;
  --sheet: #FFFDF8;
  --ink: #1B1A17;
  --ink-soft: #3D3932;
  --role: #4A453D;
  --margin: #6B655B;
  --rule: #CFC8B8;
  --dot: #8A8274;
  --red: #B42318;
  --hatch-a: #ECE6D9;
  --hatch-b: #E2DBCC;

  --serif: 'Newsreader', Georgia, serif;
  --mono: 'Courier Prime', 'Courier New', monospace;

  --gutter: clamp(18px, 3.6vw, 40px);  /* line-number column */
  --gutter-gap: clamp(10px, 2.4vw, 32px);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul { margin: 0; }

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(14px, 2.4vw, 28px) clamp(16px, 4vw, 56px) clamp(32px, 4vw, 64px);
  display: flex;
  flex-direction: column;
  gap: clamp(36px, 4.4vw, 60px);
}

/* ---------- Bill motifs ---------- */

del { color: var(--red); text-decoration-thickness: 2px; }
ins {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.red { color: var(--red); }

.line {
  display: flex;
  align-items: baseline;
  gap: var(--gutter-gap);
}
.ln {
  flex: 0 0 var(--gutter);
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--margin);
  user-select: none;
}
.indent { margin-left: calc(var(--gutter) + var(--gutter-gap)); }

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

.hero { display: flex; flex-direction: column; gap: clamp(10px, 1.4vw, 16px); }

.masthead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(44px, 5.6vw, 80px);
  line-height: 0.92;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.identity {
  font-size: clamp(20px, 2.1vw, 28px);
  line-height: 1.25;
  max-width: 32ch;
}
.identity ins { text-underline-offset: 5px; }

/* ---------- Section headings ---------- */

.block { display: flex; flex-direction: column; gap: 14px; }

h2 {
  font-size: clamp(22px, 2vw, 27px);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Main cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(12px, 1.4vw, 18px);
}
.span-5  { grid-column: span 5; }
.span-6  { grid-column: span 6; }
.span-7  { grid-column: span 7; }

.card {
  min-width: 0;
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: clamp(14px, 1.5vw, 20px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card--compact { padding: clamp(14px, 1.5vw, 20px); gap: 12px; }

/* Figures are shown whole on white, never cropped */
.slot.slot--figure { aspect-ratio: 4 / 3; background: #fff; }
.slot.slot--figure img { object-fit: contain; }
.slot.slot--figure:has(img) { border: 1px solid var(--rule); }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.num { font-family: var(--mono); font-weight: 700; letter-spacing: 0.08em; }
.tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag { border: 1px solid var(--ink); padding: 3px 8px; }
.tag--wip { border-style: dashed; border-color: var(--red); color: var(--red); }

.titles { display: flex; flex-direction: column; gap: 4px; }
h3 {
  font-size: clamp(21px, 1.7vw, 25px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
}
.card--compact h3 { font-size: clamp(20px, 1.6vw, 23px); }
.role { font-size: 15.5px; font-style: italic; color: var(--role); }
.card--compact .role { font-size: 15px; }

.desc { font-size: 15.5px; line-height: 1.5; }
.card--compact .desc { font-size: 15px; }

/* Metrics */
.metrics {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 0;
  border-top: 1px dotted var(--dot);
  padding-top: 10px;
}
.metrics .metric { flex: 1 1 100px; padding-right: 16px; }

.metric { display: flex; flex-direction: column; gap: 4px; }
.value {
  font-size: clamp(22px, 1.9vw, 28px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}
.card--compact .value { font-size: clamp(21px, 1.8vw, 26px); }
.label {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-soft);
}

/* ---------- Photo slots ----------
   Each slot shows a hatched placeholder with a label.
   Put the matching file in images/ and the photo covers the placeholder. */

.photos { display: grid; gap: 8px; }
.photos--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.slot {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: repeating-linear-gradient(135deg, var(--hatch-a) 0 10px, var(--hatch-b) 10px 20px);
  border: 1px dashed var(--dot);
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot--wide { aspect-ratio: 2 / 1; }
.slot--43 { aspect-ratio: 4 / 3; }
.slot--square { aspect-ratio: 1 / 1; }

.slot::after {
  content: attr(data-label);
  padding: 12px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4F4A42;
}
.slot img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.slot:has(img) { border-color: transparent; }

/* Coral card: square slots so the portrait photo and the poster figure both fit */
.photos--tall > .slot,
.photos--tall > .slot.slot--figure { aspect-ratio: 1 / 1; }

/* ---------- Other activities (small cards) ---------- */

.small-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.small-card {
  min-width: 0;
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.small-card--wide { grid-column: 1 / -1; border: 1px dashed var(--red); }
.small-card--wide .small-line { max-width: 75ch; }
.small-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
}
.small-top .num { font-size: 12px; }
.small-top .tags { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.small-top .value { font-size: clamp(20px, 1.7vw, 24px); text-align: right; }
.small-name { font-size: 17px; font-weight: 600; line-height: 1.2; }
.small-line { font-size: 14px; line-height: 1.45; color: var(--ink-soft); }

/* ---------- Recognition ---------- */

.recognition { border-top: 2px solid var(--ink); }
.rec-group {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 6px 24px;
  padding: 12px 0;
  border-bottom: 1px dotted var(--dot);
}
.rec-level {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  padding-top: 4px;
}
.rec-group ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 15.5px;
  line-height: 1.4;
}
.rec-group li { color: var(--ink-soft); }
.rec-group strong { color: var(--ink); font-weight: 600; }

/* ---------- Off the clock ---------- */

.off { display: flex; flex-direction: column; gap: 14px; }
.off-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 40px;
}
.off-text {
  flex: 1 1 360px;
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.4;
}
/* Flex so the row works with 2 or 3 photos: a missing glass-wave photo removes its own slot */
.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.photo-grid > .slot { flex: 1 1 0; min-width: 0; }
.end-email {
  align-self: flex-start;
  padding: 12px 0;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  text-underline-offset: 4px;
}
.end-email:hover { color: var(--red); }
.end-email:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- Tablet ---------- */

@media (max-width: 960px) {
  .span-5, .span-6, .span-7 { grid-column: span 12; }
  .small-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Phone ---------- */

@media (max-width: 640px) {
  .small-cards { grid-template-columns: minmax(0, 1fr); }
  .rec-group { grid-template-columns: minmax(0, 1fr); }
  .photo-grid > .slot { flex: 1 1 calc(50% - 6px); }
  .photo-grid > .slot:first-child { flex-basis: 100%; }
}
