/* =====================================================================
   ÁLVARO MANRIQUE · Portfolio
   style.css: how the portfolio LOOKS.

   Same grid as the homepage: 80px side margins, 24px gutters.
   Colour rules:
     · blue is the background, everywhere;
     · ALL text is white;
     · the orange-red (#F2513F) is only for graphic details: the cursor,
       the progress line, the active underline. Never for text.
   ===================================================================== */

:root {
  --blue:  #2A3392;   /* main colour, background */
  --red:   #F2513F;   /* graphic accents only (never text) */
  --white: #FFFFFF;   /* all text */
  --yellow: #FEB41A;  /* secondary, optional (graphic details) */
  --ink:   #14161F;   /* station outlines, like on the map */
  --rule:  rgba(255,255,255,.22);
  --soft:  rgba(255,255,255,.07);
  --m: calc(80 * var(--px));          /* side margin, same as the homepage */
  --g: calc(24 * var(--px));          /* gutter */
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--blue);
  color: var(--white);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  cursor: none;                /* the orange dot replaces the mouse pointer */
}
body.one-screen { overflow: hidden; }   /* the portfolio index: one screen, no scrolling */
a, button { color: inherit; cursor: none; }
.meta { font-size: calc(12 * var(--px)); letter-spacing: .12em; text-transform: uppercase; }

/* The page is a column that exactly fills the window:
   header, title row, carousel (takes whatever height is left), progress. */
.stage {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(40 * var(--px)) 0 calc(36 * var(--px));
}

/* ---------------------------------------------------------------------
   HEADER
   --------------------------------------------------------------------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--m);
}
.logo img { display: block; height: calc(64 * var(--px)); width: auto; }

nav { display: flex; align-items: center; gap: calc(36 * var(--px)); }
.menu { display: flex; gap: calc(32 * var(--px)); margin: 0; padding: 0; list-style: none; }
.menu a {
  position: relative;
  font-size: calc(20 * var(--px));
  text-decoration: none;
}
/* The orange underline: grows on hover, stays on the current page */
.menu a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: calc(-6 * var(--px));
  height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.menu a:hover::after, .menu a.current::after { transform: scaleX(1); }

.lang {
  display: flex;
  padding: calc(4 * var(--px));
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: calc(999 * var(--px));
}
.lang a {
  display: flex; align-items: center; gap: calc(7 * var(--px));
  padding: calc(6 * var(--px)) calc(13 * var(--px));
  border-radius: calc(999 * var(--px));
  font-size: calc(14 * var(--px)); font-weight: 500; letter-spacing: .06em;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  transition: color .2s, background .2s;
}
.lang a:hover { color: #fff; }
.lang a.active { background: #fff; color: var(--blue); }
.lang .flag { font-size: calc(16 * var(--px)); line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }

/* ---------------------------------------------------------------------
   TITLE ROW
   --------------------------------------------------------------------- */
.titlerow {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 var(--m);
  margin: calc(44 * var(--px)) 0 calc(32 * var(--px));
}
h1 {
  margin: 0;
  font: italic 400 calc(120 * var(--px))/.86 'Instrument Serif', Georgia, serif;
  letter-spacing: -1.5px;
}
.sub { margin: calc(16 * var(--px)) 0 0; opacity: .65; }

.ctrl { display: flex; align-items: center; gap: calc(20 * var(--px)); padding-bottom: calc(6 * var(--px)); }
.count { opacity: .8; margin-right: calc(8 * var(--px)); }
.count b { font-weight: 500; opacity: 1; }
.ctrl button {
  all: unset;
  cursor: none;
  width: calc(52 * var(--px)); height: calc(52 * var(--px));
  border: 1.5px solid rgba(255,255,255,.6);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: calc(20 * var(--px));
  transition: background .2s, color .2s, border-color .2s, opacity .2s;
}
.ctrl button:hover { background: #fff; color: var(--blue); border-color: #fff; }
.ctrl button:disabled { opacity: .3; pointer-events: none; }

/* ---------------------------------------------------------------------
   THE CAROUSEL
   --cw (card width) is set by main.js so the covers always fill the
   height that's left on screen, whatever the window size.
   --------------------------------------------------------------------- */
.track {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: var(--g);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 var(--m);
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--m);
  scrollbar-width: none;
  outline: none;
}
.track::-webkit-scrollbar { display: none; }
.track.dragging { scroll-snap-type: none; }

.card {
  flex: 0 0 var(--cw, calc(340 * var(--px)));
  height: 100%;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  text-decoration: none;
  user-select: none;
  -webkit-user-drag: none;
}
.card:last-child { margin-right: var(--m); }

/* The cover: a 4:5 "magazine cover" with a metro line running across */
.cover {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--soft);
  outline: 1px solid var(--rule);
  outline-offset: -1px;
}
.cover svg.line { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }   /* the line runs over the photo, like a map */
.cover .station {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .4s cubic-bezier(.3, 1.6, .5, 1);
}
.card:hover .cover .station { transform: scale(1.5); }

.cover .mast {
  position: absolute; left: calc(22 * var(--px)); right: calc(22 * var(--px)); top: calc(20 * var(--px)); z-index: 3;
  display: flex; justify-content: space-between;
}
/* Where the cover photo / looping video will go */
.cover .ph {
  position: absolute; left: calc(22 * var(--px)); right: calc(22 * var(--px)); top: calc(62 * var(--px)); bottom: calc(112 * var(--px));
  background: rgba(255,255,255,.12);
  display: grid; place-items: center;
  color: rgba(255,255,255,.75);
  transition: transform .8s cubic-bezier(.2, .7, .2, 1), background .4s;
}
.card:hover .cover .ph { transform: scale(1.035); background: rgba(255,255,255,.17); }
.cover .ph { overflow: hidden; }
.cover .ph img, .cover .ph video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .issue {
  position: absolute; left: calc(22 * var(--px)); bottom: calc(16 * var(--px)); z-index: 3;
  font: italic 400 calc(72 * var(--px))/.9 'Instrument Serif', Georgia, serif;
}

/* Caption under the cover */
.cap { padding-top: calc(16 * var(--px)); height: calc(84 * var(--px)); }
.cap h2 {
  margin: 0;
  font: italic 400 calc(34 * var(--px))/1 'Instrument Serif', Georgia, serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cap .meta { display: block; margin-top: calc(10 * var(--px)); opacity: .65; }

/* ---------------------------------------------------------------------
   PROGRESS: a mini metro line, one station per project
   --------------------------------------------------------------------- */
.progress {
  display: flex;
  align-items: center;
  gap: calc(40 * var(--px));
  padding: 0 var(--m);
  margin-top: calc(22 * var(--px));
}
.rail {
  position: relative;
  flex: 0 0 calc(420 * var(--px));
  height: calc(22 * var(--px));
}
.rail::before, .rail .fill {          /* the line itself */
  content: '';
  position: absolute; left: 0; right: 0; top: 50%;
  height: calc(4 * var(--px)); margin-top: -2px;
  border-radius: 2px;
  background: rgba(255,255,255,.25);
}
.rail .fill {
  right: auto;
  width: 0;
  background: var(--red);
  transition: width .5s cubic-bezier(.3, .7, .3, 1);
}
.rail .stop {                          /* stations, clickable */
  all: unset;
  cursor: none;
  position: absolute; top: 50%;
  width: calc(14 * var(--px)); height: calc(14 * var(--px)); margin: calc(-7 * var(--px)) 0 0 calc(-7 * var(--px));
  border-radius: 50%;
  background: var(--blue);
  border: calc(2.5 * var(--px)) solid rgba(255,255,255,.55);
  box-sizing: border-box;
  transition: transform .3s cubic-bezier(.3, 1.6, .5, 1), background .3s, border-color .3s;
}
.rail .stop.passed { background: var(--red); border-color: var(--red); }
.rail .stop.on { background: #fff; border-color: var(--ink); transform: scale(1.45); }
.hint { opacity: .5; }

/* ---------------------------------------------------------------------
   THE DOT CURSOR
   14px orange dot. Over a cover it grows into a "Ver" bubble; over
   links and buttons it grows a little.
   --------------------------------------------------------------------- */
#dot {
  position: fixed; left: 0; top: 0; z-index: 99;
  width: calc(14 * var(--px)); height: calc(14 * var(--px)); margin: calc(-7 * var(--px)) 0 0 calc(-7 * var(--px));
  border-radius: 50%;
  background: var(--red);
  pointer-events: none;
  display: grid; place-items: center;
  opacity: 0;
  transition: width .25s ease, height .25s ease, margin .25s ease, opacity .3s, transform .15s ease;
}
#dot.on { opacity: 1; }
#dot span {
  font-size: calc(12 * var(--px)); letter-spacing: .12em; text-transform: uppercase; color: #fff;
  opacity: 0; transition: opacity .2s;
}
#dot.big  { width: calc(84 * var(--px)); height: calc(84 * var(--px)); margin: calc(-42 * var(--px)) 0 0 calc(-42 * var(--px)); }
#dot.big span { opacity: 1; }
#dot.link { width: calc(34 * var(--px)); height: calc(34 * var(--px)); margin: calc(-17 * var(--px)) 0 0 calc(-17 * var(--px)); }
#dot.press { transform: scale(.8); }

/* ---------------------------------------------------------------------
   RESPONSIVE SCALE
   The design is drawn for a 1440px-wide screen. Every size in these
   stylesheets is written as calc(N * var(--px)), where N is its size in
   pixels at 1440. --px follows the window width (1px at 1440, more on
   bigger screens, less on smaller ones, within limits), so the whole
   page grows and shrinks proportionally and the margins scale with it.
   Below 900px wide the phone layout takes over (end of the file) and
   --px is fixed at 1px.
   --------------------------------------------------------------------- */
:root { --px: clamp(.62px, 100vw / 1440, 1.6px); }
@media (max-width: 899px) { :root { --px: 1px; } }

/* ---------------------------------------------------------------------
   "WEB EN PRUEBAS" NOTE: a small, discreet line in a corner
   --------------------------------------------------------------------- */
.beta-note {
  position: fixed; right: calc(24 * var(--px)); bottom: calc(18 * var(--px)); z-index: 50;   /* bottom-right: clear of the carousel's progress line */
  padding: 5px 10px; border-radius: 999px;
  background: var(--blue);
  font: 500 10px/1.2 'Instrument Sans', system-ui, sans-serif;
  letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.55);
  pointer-events: none;
}

/* =====================================================================
   PHONE LAYOUT (below 900px wide; reference: iPhone 15 Pro Max, 430px)
   ===================================================================== */
@media (max-width: 899px) {
  :root { --m: 20px; --g: 14px; }
  html, body { cursor: auto; }
  a, button { cursor: pointer; }

  /* Header: smaller logo, compact menu and language switch */
  .top { padding-top: env(safe-area-inset-top); }
  .logo img { height: 40px; }
  nav { gap: 14px; }
  .menu { gap: 16px; }
  .menu a { font-size: 16px; }
  .lang { padding: 3px; }
  .lang a { padding: 5px 9px; font-size: 12px; gap: 0; }
  .lang .flag { display: none; }

  /* Portfolio: title row */
  .stage { padding: 18px 0 calc(40px + env(safe-area-inset-bottom)); }
  .titlerow { margin: 28px 0 20px; align-items: flex-end; }
  h1 { font-size: 58px; letter-spacing: -.5px; }
  .sub { margin-top: 10px; }
  .ctrl { gap: 10px; padding-bottom: 2px; }
  .count { margin-right: 2px; white-space: nowrap; }
  .ctrl button { width: 40px; height: 40px; font-size: 16px; }

  /* Portfolio: the carousel, swiped with the finger */
  .track { align-items: center; touch-action: pan-x; }
  .card { height: auto; }
  .cover { flex: none; aspect-ratio: 4 / 5; }
  .cover .mast { left: 14px; right: 14px; top: 13px; }
  .cover .ph { left: 14px; right: 14px; top: 44px; bottom: 76px; }
  .cover .issue { left: 14px; bottom: 10px; font-size: 52px; }
  .cap { height: auto; padding-top: 12px; }
  .cap h2 { font-size: 26px; }

  .progress { margin-top: 14px; gap: 16px; }
  .rail { flex: 1; }
  .hint { display: none; }

  /* on phones: centred at the very bottom, clear of the carousel's progress line */
  .beta-note { left: 50%; right: auto; transform: translateX(-50%); bottom: calc(8px + env(safe-area-inset-bottom)); font-size: 9px; white-space: nowrap; }
}
