/* =====================================================================
   ÁLVARO MANRIQUE · Estudio de comunicación digital
   style.css: how everything LOOKS (colours, fonts, sizes, positions).

   Hi, curious visitor. Feel free to learn from this or reuse the idea.
   The concept: a metro map where clients' problems (files, messages,
   searches...) get stuck in a busy interchange until one click sorts it
   all out and everything flows again.

   Quick CSS primer for non-developers:
   - A "rule" is a selector (WHICH elements) followed by { properties }
     (WHAT they look like).
   - #name  targets the one element with id="name" in index.html.
   - .name  targets every element with class="name".
   - Many elements start invisible here (opacity: 0) and the JavaScript
     later adds a class such as "show" or "on" to reveal them. The
     "transition" property makes that change happen smoothly instead
     of instantly.
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. BRAND COLOURS
   Defined once as "custom properties" (variables) so they can be reused
   with var(--name). Change a colour here and it changes everywhere.
   --------------------------------------------------------------------- */
:root {
  --blue: #2A3392;   /* background, taken from the business card */
  --red:  #F2513F;   /* name and cursor */
  --ink:  #14161F;   /* near-black used for station outlines */
}


/* ---------------------------------------------------------------------
   2. THE PAGE ITSELF
   Full-screen blue canvas with no scrolling. On phones the map frames
   itself around the jam (see main.js) and the layout below takes over.
   --------------------------------------------------------------------- */
html, body {
  margin: 0;               /* browsers add a small margin by default; remove it */
  height: 100%;
  background: var(--blue);
  overflow: hidden;        /* no scrollbars: everything fits on one screen */
}


/* ---------------------------------------------------------------------
   3. THE METRO MAP
   The <svg id="map"> (a vector drawing) is pinned behind everything and
   stretched over the whole window.
   --------------------------------------------------------------------- */
#map {
  position: fixed;   /* stays put, attached to the window */
  inset: 0;          /* shorthand for top/right/bottom/left: 0 = cover the window */
  width: 100%;
  height: 100%;
  display: block;
}


/* ---------------------------------------------------------------------
   4. NAME + CONTACT BLOCK (top-left corner)
   z-index decides what sits on top when things overlap: a higher
   number is closer to the viewer. The text (2) sits above the map.
   --------------------------------------------------------------------- */
.brand {
  position: fixed;
  left: calc(80 * var(--px));    /* margin from the left edge */
  top: calc(72 * var(--px));     /* margin from the top edge */
  z-index: 2;
}

/* The big "Álvaro Manrique" title, styled after the business card */
h1 {
  margin: 0;
  font-family: 'Instrument Serif', Georgia, serif;   /* loaded from Google Fonts; Georgia is the fallback */
  font-style: italic;
  font-weight: 400;
  font-size: calc(136 * var(--px));
  line-height: .86;          /* pulls the two lines close together, like a logo */
  letter-spacing: -1px;
  color: var(--red);
  opacity: 0;                /* hidden at first... */
  transition: opacity 1s ease;
}
h1.show { opacity: 1; }      /* ...and faded in when JavaScript adds "show" */

/* An invisible marker right after "Álvaro". It sits on the text's
   baseline: JavaScript measures it and parks the cursor so that the
   arrow's bottom rests on the baseline, like on the business card.
   Its height is 0 so the big cursor never pushes the lines apart. */
#cursor-home {
  display: inline-block;
  width: calc(72 * var(--px));               /* same width as the cursor */
  height: 0;
  margin-left: calc(18 * var(--px));         /* gap between "Álvaro" and the cursor */
  vertical-align: baseline;
}

/* Subheading + email + phone, revealed at the very end */
#contact {
  margin-top: calc(40 * var(--px));
  font-family: 'Instrument Sans', system-ui, sans-serif;
  color: #fff;
}
#contact .sub {
  font-size: calc(28 * var(--px));
  letter-spacing: -.2px;
}
#contact .links { margin-top: calc(22 * var(--px)); }
#contact a {
  display: block;            /* one link per line */
  width: fit-content;        /* the clickable area is only as wide as the text */
  margin-top: calc(6 * var(--px));
  font-size: calc(19 * var(--px));
  letter-spacing: .03em;
  color: rgba(255,255,255,.82);   /* white at 82% opacity: slightly softer */
  text-decoration: none;          /* no underline */
  transition: color .2s;
}
#contact a:hover { color: var(--red); }   /* turns red under the mouse */

/* Generic "reveal" effect: start transparent and 10px lower,
   then rise into place when the class "show" is added. */
.reveal {
  opacity: 0;
  transform: translateY(calc(10 * var(--px)));
  transition: opacity .9s ease, transform .9s ease;
}
.reveal.show { opacity: 1; transform: none; }


/* ---------------------------------------------------------------------
   5. THE ANIMATED CURSOR
   A small box holding the cursor drawing. JavaScript moves it around
   the screen by changing its "transform: translate(x, y)".
   --------------------------------------------------------------------- */
#cursor {
  position: fixed;
  left: 0;
  top: 0;
  /* A natural computer cursor, just a bit bigger than usual: the
     arrow is roughly as tall as the capital letters of "Álvaro".
     72 × 96 keeps the logo arrow's own proportions. */
  width: calc(72 * var(--px));
  height: calc(96 * var(--px));
  z-index: 5;               /* above everything else */
  pointer-events: none;     /* the visitor's real mouse "passes through" it */
  opacity: 0;
  transition: opacity .8s ease;
  will-change: transform;   /* hint to the browser: this will move, prepare for it (smoother) */
}
#cursor.show { opacity: 1; }
#cursor svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 6% 6%;     /* the "click" squeeze shrinks toward the arrow's tip */
}


/* ---------------------------------------------------------------------
   6. STATIONS AND THE BIG INTERCHANGE (the "hub")
   Both start shrunk to nothing (scale 0) and pop in when JavaScript
   adds the class "on". The cubic-bezier with a value above 1 (1.6)
   makes them overshoot slightly and settle back: a small bounce.
   transform-box + transform-origin make them grow from their own
   centre (inside an SVG they would otherwise grow from the corner).
   --------------------------------------------------------------------- */
.station, #hub {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1);
}
.station.on, #hub.on { transform: scale(1); }

/* While the hub is jammed it "breathes": grows 12% and back, forever */
#hub.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* The white rings that spread out when the cursor clicks
   also need to grow from their own centre */
.ripple {
  transform-box: fill-box;
  transform-origin: center;
}


/* ---------------------------------------------------------------------
   7. NAVIGATION (bottom-right)
   Lives in the empty corner the map leaves once it thins out. Hidden
   at first; JavaScript adds "show" at the end of the animation and
   each item rises into place one after another (see --i below).
   --------------------------------------------------------------------- */
#nav {
  position: fixed;
  right: calc(56 * var(--px));
  bottom: calc(56 * var(--px));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: calc(36 * var(--px));
  padding: calc(14 * var(--px)) calc(24 * var(--px)) calc(14 * var(--px)) calc(28 * var(--px));
  border-radius: calc(999 * var(--px));
  background: var(--blue);   /* a solid backing so metro lines pass cleanly underneath */
  opacity: 0;
  transition: opacity .6s ease;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  pointer-events: none;      /* not clickable while invisible */
}
#nav.show { pointer-events: auto; opacity: 1; }

#nav .menu {
  display: flex;
  gap: calc(32 * var(--px));
  margin: 0;
  padding: 0;
  list-style: none;          /* no bullet points */
}

/* Every link and the language switch fade/rise in, staggered by --i */
#nav li, #nav .lang {
  opacity: 0;
  transform: translateY(calc(10 * var(--px)));
  transition: opacity .8s ease, transform .8s ease;
  transition-delay: calc(var(--i, 0) * 120ms);
}
#nav li:nth-child(1) { --i: 0; }
#nav li:nth-child(2) { --i: 1; }
#nav li:nth-child(3) { --i: 2; }
#nav .lang           { --i: 3; }
#nav.show li, #nav.show .lang { opacity: 1; transform: none; }

/* Menu links: white, with a red underline that grows on hover */
#nav .menu a {
  position: relative;
  font-size: calc(22 * var(--px));
  letter-spacing: -.1px;
  color: #fff;
  text-decoration: none;
  transition: color .2s;
}
#nav .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;
}
#nav .menu a:hover { color: var(--red); }
#nav .menu a:hover::after { transform: scaleX(1); }

/* Language switch: a small pill holding ES | EN */
#nav .lang {
  display: flex;
  padding: calc(4 * var(--px));
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: calc(999 * var(--px));
}
#nav .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;
}
#nav .lang a:hover { color: #fff; }
#nav .lang a.active { background: #fff; color: var(--blue); }
#nav .lang .flag {
  font-size: calc(16 * var(--px));
  line-height: 1;
  /* Apple's emoji font first, so the flags look the same as on iPhone/Mac */
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

/* ---------------------------------------------------------------------
   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; left: calc(24 * var(--px)); bottom: calc(18 * var(--px)); z-index: 50;
  padding: 5px 10px; border-radius: 999px;
  background: none;
  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)
   The map is cropped around the jam by main.js, so the whole story
   (traffic piling up, the cursor clicking, the knot untangling) stays
   in view. Name and contact sit on top, the navigation at the bottom.
   ===================================================================== */
@media (max-width: 899px) {
  html, body { height: 100%; }
  .brand { left: 24px; top: calc(36px + env(safe-area-inset-top)); }
  h1 { font-size: 66px; }
  #cursor { width: 42px; height: 56px; }
  #cursor-home { width: 42px; margin-left: 10px; }
  #contact { margin-top: 18px; }
  /* on a phone the metro lines run behind the text: a blue halo keeps it legible */
  h1, #contact { text-shadow: 0 0 6px var(--blue), 0 0 12px var(--blue), 0 0 18px var(--blue); }
  #contact .sub { font-size: 18px; }
  #contact .links { margin-top: 10px; }
  #contact a { font-size: 15px; margin-top: 3px; }

  #nav {
    left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom));
    justify-content: space-between;
    gap: 12px; padding: 10px 10px 10px 22px;
  }
  #nav .menu { gap: 22px; }
  #nav .menu a { font-size: 18px; }
  #nav .lang a { padding: 5px 10px; font-size: 12px; }

  .beta-note { left: auto; right: 16px; top: calc(16px + env(safe-area-inset-top)); bottom: auto; font-size: 9px; }
}
