/* ============================================================
   Davide Mirza — Portfolio
   Editorial / grotesk system: off-white + near-black, flat.
   Single source of truth. Every page links this file.
   ============================================================ */

:root {
  --ink:        #1a1a1a;
  --ink-soft:   #4a4a4a;
  --muted:      #8c8c8c;
  --faint:      #b8b8b8;
  --bg:         #fafaf8;
  --surface:    #f2f2f0;
  --rule:       #dcdcd8;
  --font: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --pad: clamp(14px, 1.4vw, 22px);
  --gut: clamp(20px, 5vw, 90px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--ink); color: var(--bg); }

/* ---------- Shared primitives ---------- */

.bleed { padding-left: var(--pad); padding-right: var(--pad); }

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* Tiny bold meta label — the workhorse of this design */
.label, .section-label, .exp-card-meta, .back-link, .footer-copy, .tag,
.article figcaption, .nav-links a, .nav-logo {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.4;
  text-transform: none;
}
.label { display: block; }
.muted { color: var(--muted); }

.mark::before { content: '■'; margin-right: 0.55em; font-size: 0.75em; vertical-align: 0.12em; }

/* Big display type */
.display {
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.rule { height: 1px; background: var(--rule); border: 0; }

/* ---------- Legacy nav (inner pages): reduced to a hairline bar ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: none;
}
.nav-inner {
  max-width: none; margin: 0; padding: 0 var(--pad);
  display: flex; align-items: center; justify-content: space-between;
  height: 44px;
}
.nav-logo { color: var(--ink); text-transform: none; letter-spacing: 0.005em; font-size: 0.72rem; font-weight: 700; }
.nav-logo span { color: var(--ink); }
.nav-links { display: flex; gap: 18px; align-items: center; list-style: none; }
.nav-links a { color: var(--muted); transition: color 0.15s; }
.nav-links a:hover { color: var(--ink); }
.nav-links .nav-cta { border: 0; color: var(--muted); padding: 0; border-radius: 0; }
.nav-links .nav-cta:hover { background: none; color: var(--ink); }

/* ============================================================
   HOMEPAGE
   ============================================================ */

/* Opening screen */
.opener {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px var(--pad) clamp(10px, 2vh, 26px);
}
.opener-top { text-align: center; }
.opener-top .label { color: var(--ink); }
.opener-bottom { display: flex; justify-content: flex-end; }
.wordmark {
  font-weight: 700;
  font-size: clamp(2.6rem, 11.2vw, 12rem);
  letter-spacing: -0.045em;
  line-height: 0.86;
  display: flex; align-items: flex-end; gap: 0.06em;
  white-space: nowrap;
}
.wordmark .arrow {
  font-size: 0.62em; font-weight: 400; letter-spacing: 0;
  transform: translateY(-0.06em);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
}
.wordmark:hover .arrow { transform: translate(0.1em, 0.06em); }

/* Project row header: [ ■ year | title | More → ] */
.row-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 16px;
  padding: 0 var(--pad);
  margin: clamp(48px, 8vh, 110px) 0 clamp(14px, 2vh, 26px);
}
.row-head .rh-year { justify-self: start; }
.row-head .rh-title { justify-self: center; text-align: center; }
.row-head .rh-more { justify-self: end; transition: opacity 0.15s; }
.row-head a.rh-more:hover { opacity: 0.45; }
.row-head .rh-more .a { display: inline-block; transition: transform 0.25s cubic-bezier(.2,.8,.2,1); }
.row-head a.rh-more:hover .a { transform: translateX(4px); }

/* Carousel */
.carousel { position: relative; }
.stage {
  position: relative;
  height: clamp(300px, 66vh, 720px);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.stage img {
  position: absolute;
  max-width: min(78vw, 900px);
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.stage img.on { opacity: 1; }
.stage .zone {
  position: absolute; top: 0; bottom: 0; width: 50%;
  z-index: 3; background: transparent; border: 0; padding: 0;
}
.stage .zone.prev { left: 0;  cursor: w-resize; }
.stage .zone.next { right: 0; cursor: e-resize; }
.counter {
  margin-top: 12px; text-align: center;
  font-family: var(--mono); font-size: 0.66rem; font-weight: 400;
  color: var(--muted); letter-spacing: 0.02em;
}
.counter[hidden] { display: none; }

/* Text index of remaining work */
.index-block { margin: clamp(70px, 11vh, 150px) 0 0; padding-bottom: 10px; }
.index-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 var(--pad); margin-bottom: 10px;
}
.index-list { border-top: 1px solid var(--rule); }
.index-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1.3fr) minmax(0, 2fr) 26px;
  gap: 16px; align-items: baseline;
  padding: 13px var(--pad);
  border-bottom: 1px solid var(--rule);
  transition: background 0.15s, padding-left 0.2s;
}
a.index-row:hover { background: var(--surface); }
.index-row .ix-year { font-family: var(--mono); font-size: 0.66rem; color: var(--muted); }
.index-row .ix-name { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.015em; }
.index-row .ix-desc { font-size: 0.78rem; font-weight: 500; color: var(--muted); }
.index-row .ix-go { justify-self: end; font-size: 0.8rem; color: var(--faint); transition: transform 0.2s, color 0.2s; }
a.index-row:hover .ix-go { color: var(--ink); transform: translateX(4px); }
.index-row.static { opacity: 0.72; }

/* Big statement (About) */
.statement-block { padding: clamp(80px, 14vh, 190px) var(--pad) clamp(50px, 8vh, 110px); }
.statement {
  font-weight: 700;
  font-size: clamp(1.75rem, 5.4vw, 4.4rem);
  letter-spacing: -0.038em;
  line-height: 1.0;
  max-width: 17ch;
}
.statement-sub {
  margin-top: clamp(26px, 4vh, 54px);
  max-width: 46ch;
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.6;
}
.facts { margin-top: 34px; display: grid; gap: 4px; max-width: 620px; }
.facts div { display: flex; justify-content: space-between; gap: 20px; font-size: 0.74rem; font-weight: 700; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.facts div span:last-child { color: var(--muted); text-align: right; }

/* Section head shared by Experience / Archives */
.block-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 12px; margin-bottom: clamp(26px, 4vh, 48px);
  border-bottom: 1px solid var(--rule);
}

/* Experience list */
.exp-block { padding: clamp(56px, 9vh, 120px) var(--pad) clamp(50px, 8vh, 100px); }
.exp-item {
  display: grid;
  grid-template-columns: clamp(150px, 17vw, 240px) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 52px);
  align-items: start;
  padding: clamp(24px, 3.5vh, 40px) 0;
  border-bottom: 1px solid var(--rule);
}
.exp-item:first-of-type { border-top: 0; }
.exp-logo img {
  width: 100%; max-width: 200px; height: auto;
  filter: grayscale(1); opacity: 0.9;
  transition: opacity 0.25s;
}
a.exp-item:hover .exp-logo img { opacity: 1; }
.exp-text { max-width: 760px; }
.exp-item h3 {
  font-weight: 700;
  font-size: clamp(1.5rem, 4.2vw, 3rem);
  letter-spacing: -0.038em;
  line-height: 1.0;
  display: inline-block;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 0% 2px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size 0.35s cubic-bezier(.2,.8,.2,1);
}
a.exp-item:hover h3 { background-size: 100% 2px; }
.exp-item .role { margin-top: 6px; font-size: 0.72rem; font-weight: 700; }
.exp-item .blurb { margin-top: 12px; font-size: 0.82rem; color: var(--ink-soft); max-width: 58ch; line-height: 1.6; }
.exp-item .go { margin-top: 16px; display: inline-block; color: var(--muted); transition: color 0.2s; }
.exp-item .go .a { display: inline-block; transition: transform 0.25s cubic-bezier(.2,.8,.2,1); }
a.exp-item:hover .go { color: var(--ink); }
a.exp-item:hover .go .a { transform: translateX(4px); }

/* Contact */
.contact-block {
  border-top: 1px solid var(--rule);
  padding: clamp(30px, 5vh, 60px) var(--pad) clamp(30px, 5vh, 56px);
  display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start;
}
.contact-list { margin-top: 18px; display: grid; gap: 5px; }
.contact-list a { font-size: 0.78rem; font-weight: 700; display: inline-flex; gap: 10px; align-items: center; width: max-content; }
.contact-list a span.ic { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); width: 2.4em; }
.contact-list a:hover { text-decoration: underline; text-underline-offset: 3px; }
.contact-note { font-size: 0.78rem; font-weight: 700; text-align: right; max-width: 40ch; justify-self: end; }
.colophon { padding: 0 var(--pad) 26px; display: flex; justify-content: space-between; font-size: 0.66rem; font-weight: 500; color: var(--faint); }

/* ============================================================
   INNER PAGES — legacy class overrides
   ============================================================ */

/* Sub-page hero */
.page-hero, .hero {
  background: var(--bg);
  color: var(--ink);
  padding: clamp(46px, 9vh, 110px) 0 clamp(26px, 4vh, 46px);
  border-bottom: 0;
}
.page-hero .section-label, .hero .hero-kicker { color: var(--muted); font-family: var(--font); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.005em; margin-bottom: 14px; }
.page-hero h1, .hero h1 {
  font-weight: 700;
  font-size: clamp(2rem, 6.4vw, 5rem);
  letter-spacing: -0.04em;
  line-height: 0.98;
  margin-bottom: 18px;
  max-width: 20ch;
}
.page-hero p, .hero p { color: var(--ink-soft); max-width: 60ch; font-size: 0.88rem; line-height: 1.6; }
.hero h2 { font-size: clamp(1rem, 2vw, 1.4rem); font-weight: 700; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 18px; max-width: 26ch; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 48px; align-items: end; }
.hero-img { border-radius: 0; box-shadow: none; border: 0; width: 100%; object-fit: cover; }

/* Chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 22px; }
.chip {
  background: none; color: var(--muted);
  font-family: var(--font); font-size: 0.7rem; font-weight: 700;
  padding: 4px 10px; border-radius: 0; border: 1px solid var(--rule);
}

/* Banner image under sub-page hero */
.banner-img { width: 100%; max-height: 62vh; object-fit: cover; border-radius: 0; box-shadow: none; margin: 0 auto; }
.banner-wrap { position: static; }

/* Sections */
.section { padding: clamp(48px, 8vh, 100px) 0; }
.section-alt { background: var(--bg); border-top: 1px solid var(--rule); }
.section-label { color: var(--muted); font-family: var(--font); margin-bottom: 12px; }
.section-title {
  font-weight: 700; color: var(--ink);
  font-size: clamp(1.5rem, 4vw, 2.9rem);
  letter-spacing: -0.035em; line-height: 1.0; margin-bottom: 16px;
}
.section-intro { color: var(--muted); max-width: 60ch; margin-bottom: 40px; font-size: 0.84rem; line-height: 1.6; }

/* Cards → flat editorial tiles */
.exp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 3vw, 44px); }
.exp-card, .proj-card {
  background: none; border: 0; border-top: 1px solid var(--rule);
  border-radius: 0; overflow: visible; box-shadow: none;
  display: flex; flex-direction: column; color: inherit;
  padding-top: 14px; transition: opacity 0.2s;
}
.exp-card:hover, a.proj-card:hover { transform: none; box-shadow: none; text-decoration: none; }
.exp-card img, .proj-card img {
  width: 100%; object-fit: cover; border-radius: 0;
  filter: grayscale(0.12); transition: filter 0.3s, opacity 0.3s;
}
.exp-card img { height: clamp(190px, 26vw, 320px); }
.proj-card img { height: clamp(170px, 22vw, 280px); }
a.proj-card:hover img, .exp-card:hover img { filter: grayscale(0); opacity: 0.86; }
.exp-card-body, .proj-card-body { padding: 14px 0 0; flex: 1; display: flex; flex-direction: column; }
.exp-card-meta { color: var(--muted); font-family: var(--font); margin-bottom: 6px; }
.exp-card h3 { color: var(--ink); font-size: clamp(1.1rem, 2.2vw, 1.6rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin-bottom: 10px; }
.proj-card h3 { color: var(--ink); font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.exp-card p, .proj-card p { color: var(--muted); font-size: 0.8rem; line-height: 1.55; flex: 1; }
.exp-card .card-link { margin-top: 16px; font-size: 0.72rem; font-weight: 700; color: var(--ink); }
.exp-card .card-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.exp-card-badge {
  display: inline-block; align-self: flex-start; background: none; color: var(--ink);
  border: 1px solid var(--ink);
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 0; margin-bottom: 10px;
}
.proj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 2.4vw, 40px); }
.proj-card .tags { margin-top: 12px; display: flex; gap: 5px; flex-wrap: wrap; }
.tag {
  font-family: var(--font); font-size: 0.66rem; font-weight: 700;
  color: var(--muted); background: none; border: 1px solid var(--rule);
  padding: 2px 7px; border-radius: 0;
}

/* Buttons */
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 0;
  font-weight: 700; font-size: 0.74rem; transition: background 0.2s, color 0.2s;
  border: 1px solid var(--ink);
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--bg); color: var(--ink); text-decoration: none; transform: none; }
.btn-outline { border: 1px solid var(--ink); color: var(--ink); background: none; }
.btn-outline:hover { background: var(--ink); color: var(--bg); text-decoration: none; transform: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Article body */
.article { max-width: 760px; margin: 0 auto; padding: clamp(46px, 7vh, 84px) var(--pad) clamp(60px, 10vh, 110px); }
.article h2 {
  color: var(--ink); font-size: clamp(1.15rem, 2.4vw, 1.65rem);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.15;
  margin: 52px 0 16px; padding-bottom: 0; border-bottom: 0; display: block;
}
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; margin: 30px 0 10px; }
.article p { margin-bottom: 16px; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.65; }
.article ul, .article ol { margin: 0 0 16px 20px; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.65; }
.article li { margin-bottom: 5px; }
.article a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.article img { border-radius: 0; box-shadow: none; margin: 26px 0; }
.article figure { margin: 34px 0; }
.article figcaption { color: var(--muted); margin-top: 9px; font-family: var(--font); text-align: left; }
.article strong { font-weight: 700; color: var(--ink); }
.img-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.img-pair img { margin: 0; height: 100%; object-fit: cover; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 30px 0; }
.gallery img {
  margin: 0; aspect-ratio: 1;
  object-fit: contain; background: var(--surface);
  padding: 8px; transition: opacity 0.25s;
}
.gallery img:hover { opacity: 0.82; }

/* Highlights */
.highlights { list-style: none; margin: 22px 0 !important; padding: 0; }
.highlights li { padding-left: 22px; position: relative; margin-bottom: 11px !important; color: var(--ink-soft); }
.highlights li::before { content: '■'; position: absolute; left: 0; top: 0.05em; color: var(--ink); font-size: 0.6em; }

/* Video / notes */
.video-note {
  background: var(--surface); color: var(--ink-soft); border-radius: 0;
  padding: 18px 20px; margin: 30px 0; border: 0; border-left: 2px solid var(--ink);
  font-size: 0.82rem;
}
.video-note strong { color: var(--ink); }
figure.video-embed { margin: 34px 0; }
.video-embed .frame, figure.video-embed > iframe, .video-embed > iframe {
  display: block; width: 100%; aspect-ratio: 16 / 9; height: auto;
  border: 0; border-radius: 0; box-shadow: none; background: var(--ink);
}
/* legacy div wrapper (YouTube) */
div.video-embed { position: relative; padding-bottom: 56.25%; height: 0; margin: 34px 0; }
div.video-embed > iframe { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }
.video-embed figcaption { color: var(--muted); margin-top: 9px; font-size: 0.72rem; font-weight: 700; }

.editable-note {
  background: var(--surface); border: 0; border-left: 2px solid var(--faint); border-radius: 0;
  padding: 16px 20px; margin: 30px 0; font-size: 0.8rem; color: var(--ink-soft);
}

/* Code */
details.code { margin: 30px 0; background: var(--ink); border-radius: 0; overflow: hidden; box-shadow: none; }
details.code summary {
  cursor: pointer; padding: 13px 18px; color: var(--bg);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 400;
  user-select: none; list-style: none;
}
details.code summary::-webkit-details-marker { display: none; }
details.code summary::before { content: '+ '; }
details.code[open] summary::before { content: '– '; }
details.code pre { margin: 0; padding: 6px 18px 22px; overflow-x: auto; background: var(--ink); }
details.code code { font-family: var(--mono); font-size: 0.7rem; line-height: 1.65; color: #d8d8d4; white-space: pre; }

/* Back link */
.back-link { display: inline-block; margin-bottom: 30px; font-family: var(--font); color: var(--muted); }
.back-link:hover { color: var(--ink); }

/* Footer */
.footer { background: var(--bg); color: var(--ink); border-top: 1px solid var(--rule); padding: clamp(36px, 6vh, 70px) 0 30px; }
.footer-inner { text-align: left; }
.footer h3 { color: var(--ink); font-size: clamp(1.4rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1; margin-bottom: 12px; }
.footer p { max-width: 48ch; margin: 0 0 22px; font-size: 0.82rem; color: var(--ink-soft); line-height: 1.6; }
.footer-links { display: flex; gap: 18px; justify-content: flex-start; margin-bottom: 30px; }
.footer-links a { color: var(--ink); font-weight: 700; font-size: 0.76rem; }
.footer-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-copy { font-size: 0.66rem; color: var(--faint); font-family: var(--font); font-weight: 500; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; align-items: start; }
  .proj-grid { grid-template-columns: repeat(2, 1fr); }
  .exp-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .index-row { grid-template-columns: 54px 1fr 20px; }
  .index-row .ix-desc { display: none; }
  .contact-block { grid-template-columns: 1fr; }
  .contact-note { text-align: left; justify-self: start; }
  .stage { height: clamp(260px, 48vh, 460px); }
  .stage img { max-width: 88vw; }
  .exp-item { grid-template-columns: 1fr; gap: 16px; }
  .exp-logo img { max-width: 150px; }
}
@media (max-width: 620px) {
  body { font-size: 14px; }
  .nav-links { gap: 12px; }
  .nav-links li:nth-child(n+4) { display: none; }
  .proj-grid { grid-template-columns: 1fr; }
  .img-pair, .gallery { grid-template-columns: 1fr; }
  .section { padding: 44px 0; }
  .row-head { grid-template-columns: 1fr auto; row-gap: 5px; }
  .row-head .rh-year  { grid-column: 1; grid-row: 1; }
  .row-head .rh-more  { grid-column: 2; grid-row: 1; }
  .row-head .rh-title { grid-column: 1 / -1; grid-row: 2; justify-self: start; text-align: left; }
  .statement { max-width: none; }
  .colophon { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
