/* Carmen Emilio Kotch — portfolio
   Quiet, generous, one typeface. Home = intro + case studies (one screen on desktop).
   Case studies open as a floating card over the page. */

:root {
  --ink: #141414;
  --body: #5a5a5a;
  --muted: #8f8f8f;
  --faint: #bdbdbd;
  --line: #e7e7e7;
  --paper: #ffffff;
  --mist: #f6f6f4;
  --max: 1240px;
  --gutter: clamp(22px, 5vw, 72px);
  --font: "Century Gothic", "CenturyGothic", "AppleGothic", "Questrial", "Avenir Next", sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  min-height: 100svh; display: flex; flex-direction: column;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* only the active language is visible */
html[data-lang="en"] [lang="es"]:not(html),
html[data-lang="es"] [lang="en"]:not(html) { display: none !important; }

.label { font-size: 11px; font-weight: 400; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); }

/* ---------------- header ---------------- */
.site-header { padding: clamp(20px, 3.4vh, 36px) 0; }
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.brand { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.brand-name { font-size: clamp(18px, 1.6vw, 22px); letter-spacing: 0.04em; }
.brand-role { font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted);
  padding-left: 16px; border-left: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 40px); font-size: 13px; letter-spacing: 0.04em; color: var(--muted); }
.nav a { white-space: nowrap; transition: color 0.2s; }
.nav a:hover { color: var(--ink); }
.lang-switch { display: flex; gap: 6px; align-items: center; }
.lang-switch button { background: none; border: 0; cursor: pointer; padding: 2px; letter-spacing: 0.08em; color: var(--faint); }
.lang-switch button[aria-pressed="true"] { color: var(--ink); }

/* ---------------- home ---------------- */
.home {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(48px, 7vw, 120px); align-items: center;
  padding-top: clamp(8px, 2vh, 24px); padding-bottom: clamp(24px, 5vh, 56px);
}
.lead { font-weight: 400; font-size: min(5vw, 9vh, 76px); line-height: 1.06; letter-spacing: -0.015em; }
html[data-lang="es"] .lead { font-size: min(4.4vw, 8vh, 66px); }
.intro { margin-top: clamp(20px, 4vh, 36px); max-width: 30em; font-size: clamp(15px, 1.15vw, 17px); line-height: 1.75; color: var(--body); }
.cases .label { padding-bottom: 14px; margin-bottom: clamp(16px, 3vh, 28px); border-bottom: 1px solid var(--line); }
.case-cover {
  display: block; width: 100%; padding: 0; border: 0; cursor: pointer; background: #161616;
  aspect-ratio: 16 / 9; max-height: 52vh; overflow: hidden;
}
.case-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.case-cover:hover img { transform: scale(1.03); }
.case-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-top: clamp(16px, 3vh, 26px); }
.case-no { font-size: 11px; letter-spacing: 0.22em; color: var(--muted); }
.case-title { font-weight: 400; font-size: clamp(26px, 2.4vw, 34px); line-height: 1.1; margin-top: 6px; }
.case-line { margin-top: 8px; font-size: 14px; color: var(--body); max-width: 24em; }
.case-actions { display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  font-size: 13px; letter-spacing: 0.05em; padding: 12px 22px; cursor: pointer;
  border: 1px solid var(--ink); border-radius: 999px; transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.btn-solid { background: var(--ink); color: #fff; }
.btn-solid:hover { background: #3a3a3a; border-color: #3a3a3a; }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--ink); color: #fff; }

.site-footer { padding: 18px 0 22px; font-size: 12px; color: var(--muted); }
/* ---------------- modals ---------------- */
dialog.modal { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; overflow: visible; }
dialog.modal::backdrop { background: rgba(20, 20, 20, 0.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog.modal[open] { animation: rise 0.45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }

.close {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.92);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: border-color 0.2s;
}
.close:hover { border-color: var(--ink); }

/* the film viewer */
dialog.modal-film { margin: auto; }
dialog.modal-film::backdrop { background: rgba(8, 8, 8, 0.9); backdrop-filter: none; }
dialog.modal-film video { width: min(92vw, calc(84vh * 16 / 9)); aspect-ratio: 16 / 9; background: #000; border-radius: 10px; }
dialog.modal-film .close { position: fixed; top: 20px; right: 22px; background: rgba(255, 255, 255, 0.12);
  color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* ---------------- phones / narrow ---------------- */
@media (max-width: 900px) {
  body { display: block; }
  .brand { flex-direction: column; gap: 2px; }
  .brand-role { padding-left: 0; border-left: 0; letter-spacing: 0.12em; line-height: 1.5; }  /* longer title wraps on phones */
  .site-header .wrap { flex-wrap: wrap; row-gap: 12px; }
  .brand-name { white-space: nowrap; }
  .home { grid-template-columns: 1fr; gap: 48px; padding-top: 28px; padding-bottom: 56px; }
  .lead, html[data-lang="es"] .lead { font-size: clamp(38px, 10vw, 54px); }
  .case-cover { max-height: none; }
  .case-meta { flex-direction: column; align-items: stretch; }
  .case-actions { flex-direction: row; }
  .case-actions .btn { flex: 1; }
}

/* =====================================================================
   Case study = ONE letter-size page (8.5 x 11) over the site, like a PDF.
   All sizes are in --u = 1/816 of the page width, so the page keeps the
   same composition at any screen size (816 px = a letter page at 96 dpi).
   ===================================================================== */
dialog.modal-doc {
  position: fixed; inset: 0; width: 100vw; height: 100dvh; margin: 0;
  overflow: auto; overscroll-behavior: contain; padding: 76px 24px 56px;
}
dialog.modal-doc::backdrop { background: rgba(40, 40, 40, 0.86); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
dialog.modal-doc[open] { animation: none; }
dialog.modal-doc[open] .doc { animation: rise 0.5s var(--ease); }

.doc-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px 0 24px;
  color: #e9e9e9; font-size: 13px; letter-spacing: 0.04em;
  background: rgba(28, 28, 28, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.doc-bar .close { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.28); }
.doc-bar .close:hover { border-color: #fff; }

.doc {
  /* --doc-w is set by the zoom controls; default = fit the window, max real letter size */
  --u: calc(var(--doc-w, min(816px, 92vw)) / 816);
  width: var(--doc-w, min(816px, 92vw)); aspect-ratio: 8.5 / 11; margin: 0 auto; overflow: hidden;
  flex-shrink: 0;
  background: #fff; color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: calc(60 * var(--u)) calc(64 * var(--u)) calc(44 * var(--u));
  display: flex; flex-direction: column;
}
.doc-top {
  display: flex; justify-content: space-between; gap: calc(16 * var(--u));
  font-size: calc(8.5 * var(--u)); letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted);
  padding-bottom: calc(12 * var(--u)); border-bottom: 1px solid var(--line);
}
.doc-title { font-weight: 400; font-size: calc(54 * var(--u)); line-height: 1; letter-spacing: -0.015em; margin-top: calc(22 * var(--u)); }
.doc-sub { margin-top: calc(10 * var(--u)); font-size: calc(15 * var(--u)); line-height: 1.5; color: var(--body); max-width: 34em; }

.doc-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(18 * var(--u)); margin-top: calc(22 * var(--u)); }
.doc-facts div { border-top: 1px solid var(--line); padding-top: calc(8 * var(--u)); }
.doc-facts dt { font-size: calc(7.5 * var(--u)); letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }
.doc-facts dd { margin-top: calc(4 * var(--u)); font-size: calc(10.5 * var(--u)); line-height: 1.45; }

.doc-image { margin-top: calc(22 * var(--u)); }
.doc-image img { width: 100%; height: calc(190 * var(--u)); object-fit: cover; object-position: center 40%; }
.doc-image figcaption { margin-top: calc(6 * var(--u)); font-size: calc(8.5 * var(--u)); color: var(--muted); }

.doc-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: calc(34 * var(--u)); margin-top: calc(20 * var(--u)); }
.doc-sec + .doc-sec { margin-top: calc(16 * var(--u)); }
.doc-sec h3, .doc-result h3 {
  display: flex; align-items: baseline; gap: calc(10 * var(--u));
  font-weight: 400; font-size: calc(14.5 * var(--u)); line-height: 1.2; margin-bottom: calc(6 * var(--u));
}
.doc .n { font-size: calc(8.5 * var(--u)); letter-spacing: 0.14em; color: var(--muted); }
.doc-sec p { font-size: calc(10.2 * var(--u)); line-height: 1.6; color: var(--body); }

.doc-list, .doc-steps { list-style: none; margin-top: calc(8 * var(--u)); }
.doc-list li, .doc-steps li {
  display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: calc(10 * var(--u));
  padding: calc(6 * var(--u)) 0; border-top: 1px solid var(--line);
  font-size: calc(9.6 * var(--u)); line-height: 1.45; color: var(--body);
}
.doc-steps li { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); }
.doc-list strong, .doc-steps strong { font-weight: 400; color: var(--ink); }

.doc-result { margin-top: calc(16 * var(--u)); padding: calc(16 * var(--u)) calc(20 * var(--u)); background: var(--mist); }
.doc-result p { font-size: calc(13 * var(--u)); line-height: 1.5; color: var(--ink); }

.doc-foot {
  margin-top: auto; padding-top: calc(10 * var(--u)); border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; font-size: calc(8.5 * var(--u)); letter-spacing: 0.08em; color: var(--muted);
}
.doc-foot a:hover { color: var(--ink); }

/* phones: a page this small can't be read, so the same document reflows at readable sizes */
@media (max-width: 640px) {
  dialog.modal-doc { padding: 64px 0 32px; }
  .doc { --u: 1.25px; aspect-ratio: auto; width: 94vw; padding: 28px 22px; }
  .doc-top { flex-direction: column; gap: 4px; }
  .doc-facts, .doc-cols { grid-template-columns: 1fr; }
  .doc-image img { height: auto; aspect-ratio: 16 / 9; }
  .doc-list li, .doc-steps li { grid-template-columns: 1fr; gap: 2px; }
  .doc-foot { margin-top: 28px; }
}

/* zoom controls (letter page only) */
.doc-bar-title { flex: 1; }
.zoom { display: flex; align-items: center; gap: 4px; margin-right: 14px; }
.zoom button {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  background: transparent; color: #f0f0f0; border: 1px solid rgba(255, 255, 255, 0.26); font-size: 16px; line-height: 1;
}
.zoom button:hover { border-color: #fff; }
.zoom .zoom-fit { font-size: 12px; letter-spacing: 0.06em; margin-left: 6px; }
.zoom-val { min-width: 52px; text-align: center; font-size: 12px; letter-spacing: 0.06em; color: #f0f0f0; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .zoom { display: none; } }

/* reading order 01 | 02, 03 full width, 04 full width, 05 */
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: calc(34 * var(--u)); margin-top: calc(20 * var(--u)); }
.doc-full { margin-top: calc(16 * var(--u)); padding-top: calc(14 * var(--u)); border-top: 1px solid var(--line); }
.doc-sec.doc-full + .doc-sec.doc-full { margin-top: calc(14 * var(--u)); }
.doc-full .doc-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: calc(34 * var(--u)); }
.doc-full .doc-list li { display: block; }
.doc-full .doc-list li strong { display: block; margin-bottom: calc(1 * var(--u)); }
.doc-full .doc-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(22 * var(--u)); }
.doc-full .doc-steps li { display: block; counter-increment: st; }
.doc-full .doc-steps { counter-reset: st; }
.doc-full .doc-steps li strong { display: block; margin-bottom: calc(2 * var(--u)); }
.doc-full .doc-steps li strong::before { content: "0" counter(st) "  "; color: var(--faint); font-size: calc(8 * var(--u)); letter-spacing: 0.1em; }
@media (max-width: 640px) {
  .doc-row, .doc-full .doc-list, .doc-full .doc-steps { grid-template-columns: 1fr; }
}
/* one-page fit after the reading-order change (measured in EN and ES) */
.doc { padding: calc(50 * var(--u)) calc(64 * var(--u)) calc(36 * var(--u)); }
.doc-title { font-size: calc(48 * var(--u)); margin-top: calc(18 * var(--u)); }
.doc-sub { margin-top: calc(8 * var(--u)); }
.doc-facts { margin-top: calc(16 * var(--u)); }
.doc-image { margin-top: calc(16 * var(--u)); }
.doc-image img { height: calc(132 * var(--u)); object-position: center 42%; }
.doc-row { margin-top: calc(16 * var(--u)); }
.doc-full { margin-top: calc(12 * var(--u)); padding-top: calc(10 * var(--u)); }
.doc-sec.doc-full + .doc-sec.doc-full { margin-top: calc(10 * var(--u)); }
.doc-result { margin-top: calc(12 * var(--u)); padding: calc(12 * var(--u)) calc(18 * var(--u)); }
.doc-row .doc-sec + .doc-sec { margin-top: 0; }  /* 01 and 02 start on the same line */
