/* Portafolio · Juan Camilo Mutis Arenas
   With WebGL (html.gl) the page is the two rings drawn in #gl, and #doc stays in the page only for screen
   readers and keyboard focus. Without WebGL, or with reduced motion, #doc is the page. */
:root {
  --ground: #0b0b0a;
  --ink: #efeae0;
  --ink-2: #b3ada2;
  --ink-3: #78736b;
  --hair: rgba(239, 234, 224, .16);
  --gutter: max(16px, 4vw);
  --bar: 64px;
  --statement: "SUSE", system-ui, sans-serif;
  --text: "Hanken Grotesk", system-ui, sans-serif;
  --label: "Urbanist", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 17px/1.55 var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
img, video { display: block; max-width: 100%; }
html[data-lang="es"] [lang="en"], html[data-lang="en"] [lang="es"] { display: none; }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 4px; }

/* film grain that boils */
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 30; pointer-events: none; opacity: .08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: boil .9s steps(6) infinite;
}
@keyframes boil {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* header, over both modes */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 20; height: var(--bar);
  display: flex; align-items: center; gap: 18px;
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  font: 700 12px/1 var(--label); letter-spacing: .16em; text-transform: uppercase;
}
.who { text-decoration: none; white-space: nowrap; }
.back { border: 0; background: none; color: var(--ink); font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; padding: 8px 0; white-space: nowrap; }
.back:hover { color: var(--ink-2); }
.where { color: var(--ink-2); flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang { display: flex; gap: 2px; margin-left: auto; }
.lang button { border: 0; background: none; color: var(--ink-3); font: inherit; letter-spacing: inherit; padding: 8px 6px; cursor: pointer; }
.lang button[aria-pressed="true"] { color: var(--ink); }
.hint { display: none; }

/* ---- WebGL mode ---------------------------------------------------------------- */
#gl { display: none; }
html.gl, html.gl body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.gl #gl { display: block; position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 1; touch-action: none; }
html.gl #gl.pointer { cursor: pointer; }
html.gl #doc { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
html.gl .hint {
  display: block; position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 20; margin: 0;
  font: 700 11px var(--label); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3);
  transition: opacity .8s;
}
html.gl .hint.gone { opacity: 0; }
html.gl .where { color: var(--ink-3); }
html.gl .bar { background: linear-gradient(var(--ground) 30%, rgba(11, 11, 10, 0)); height: calc(var(--bar) + 24px); padding-bottom: 24px; }

/* ---- plain page (no WebGL or reduced motion) ---------------------------------------- */
html:not(.gl) body { background: var(--ground) url(media/fondo_oscuro.webp) center / cover fixed no-repeat; }
#doc { padding: calc(var(--bar) + 8vh) var(--gutter) 12vh; max-width: 1500px; margin: 0 auto; }
.d-open { min-height: 80svh; display: flex; flex-direction: column; justify-content: center; }
.d-open h1 { margin: 0; font: 200 clamp(48px, 10vw, 168px)/.92 var(--statement); letter-spacing: -.02em; max-width: 12ch; }
.d-role { margin: 4vh 0 0; font: 300 clamp(22px, 2.6vw, 38px)/1.2 var(--statement); }
.d-line { margin: 1vh 0 0; color: var(--ink-2); max-width: 36ch; }
.d-by, .d-person { margin: 3vh 0 0; font: 700 12px var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.d-proj, .d-page { padding-top: 14vh; }
.d-num { margin: 0; font: 700 13px var(--label); letter-spacing: .2em; color: var(--ink-3); }
.d-proj h2, .d-page h2, .d-contact h2 { margin: 1vh 0 3vh; font: 200 clamp(52px, 11vw, 190px)/.9 var(--statement); letter-spacing: -.03em; }
.d-meta { margin: 0 0 2vh; font: 700 12px/1.7 var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.d-desc { margin: 0; font: 300 clamp(19px, 1.7vw, 26px)/1.45 var(--statement); max-width: 42ch; }
.d-steps { list-style: none; margin: 3vh 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; font: 700 12px var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.d-thumbs { list-style: none; margin: 6vh 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.d-thumbs a { display: block; text-decoration: none; }
.d-thumbs img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #151513; }
.d-cap, .d-fig figcaption { display: block; margin-top: 10px; font: 700 11px/1.5 var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.d-cta a { display: grid; place-items: center; aspect-ratio: 16 / 10; border: 1px solid var(--hair); font: 300 clamp(18px, 2vw, 28px) var(--statement); }
.d-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 32px; margin: 5vh 0 0; }
.d-details dt { font: 700 11px var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.d-details dd { margin: 6px 0 0; color: var(--ink-2); }
.d-media { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6vh 18px; margin-top: 8vh; }
.d-fig { margin: 0; grid-column: span 6; }
.d-fig.d-post { grid-column: span 2; }
.d-fig.d-tall { grid-column: 2 / span 2; }
.d-fig img, .d-fig video { width: 100%; background: #151513; }
.d-contact { padding-top: 16vh; }
.d-contact p { margin: 0 0 1vh; font: 300 clamp(22px, 2.4vw, 36px)/1.3 var(--statement); }
.d-contact a { text-decoration: none; border-bottom: 1px solid var(--hair); }

@media (max-width: 760px) {
  :root { --bar: 56px; }
  .where { display: none; }
  .d-fig.d-post { grid-column: span 3; }
  .d-fig.d-tall { grid-column: 1 / span 6; }
}
@media (prefers-reduced-motion: reduce) { body::after { animation: none; } }

/* plain page: titles roll into place once, like the cubes on the rings */
@media (prefers-reduced-motion: no-preference) {
  #doc h1, #doc h2 { animation: roll-in 1s cubic-bezier(.3, 1.4, .5, 1) both; transform-origin: 50% 50% -0.5em; }
}
@keyframes roll-in {
  from { transform: perspective(900px) rotateX(-90deg); opacity: .2; }
  to { transform: perspective(900px) rotateX(0); opacity: 1; }
}
