/*
 * NYC Subway design system.
 *
 * Load the fonts, then this file:
 *   <link rel="preconnect" href="https://fonts.googleapis.com">
 *   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 *   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&family=VT323&display=swap">
 *   <link rel="stylesheet" href="subway.css">
 *
 * Every piece is a class you drop onto plain markup. design/styleguide.html shows each one live with its markup.
 *
 *   Type        .display  .title  .label  .caption  .link
 *   Signage     .sign  .sign--yellow-rule  .mosaic  .tactile  .tiles  .platform
 *   Route       .bullet  .bullet--{yellow|red|blue|green|orange|purple|lime|brown|gray}  .bullet--sm/--lg  .diamond
 *   Clock       .clock  .clock--alert  .clock-board  .clock-board__label
 *   Buttons     .btn  + --express  --sign  --tile  --line  --icon   size --sm --lg --block
 *               .btn__diamond (the departing arrow)   .icon .icon--{arrow|close|info|check}
 *   Pins        .pin  .pin--tag  .pin--up  .pin__dot  .pin__stem  .pin-tag  .pin-tag__price  .pin-tag--price   (--pin --pin-stem --pin-dot)
 *   Strip map   .strip (set --line to a route color)  .stop  .stop__name  .stop__sub  .price-tag
 *   Forms       .field  .input  .check
 *   Panels      .scrim  .panel  .panel__head  .panel__title  .notice
 *
 * States: :hover, :active, :disabled, [aria-current] and [aria-expanded="true"] are styled.
 * .is-hover / .is-active force a state, for style guides and mockups.
 */

:root {
  /* Route colors. */
  --line-yellow: #fccc0a;
  --line-red: #ee352e;
  --line-blue: #0039a6;
  --line-green: #00933c;
  --line-orange: #ff6319;
  --line-purple: #b933ad;
  --line-lime: #6cbe45;
  --line-brown: #996633;
  --line-gray: #a7a9ac;
  --line: var(--line-red);

  /* Station surfaces. */
  --ink: #0d0d0d;
  --sign: #121212;
  --sign-2: #1c1c1c;
  --sign-edge: #3a3a3a;
  --paper: #f4f1ea;
  --muted: #b9b4a8;
  --faint: #8d887d;
  --tile: #efe9dc;
  --tile-grout: #d3c9b3;
  --tile-edge: #c9bfa9;
  --amber: #ff9e1b;
  --mosaic-red: #b5542b;
  --mosaic-cream: #efe6cf;
  --mosaic-green: #1f5c4a;
  --express-edge: #8f7200;
  --tactile-dot: #c99f00;
  --danger: #ff6b5f;

  --font-sign: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-clock: "VT323", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --icon-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12h15M13 6l6 6-6 6' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='square'/%3E%3C/svg%3E");
  --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='square'/%3E%3C/svg%3E");
  --icon-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 10.5v8' fill='none' stroke='black' stroke-width='3' stroke-linecap='square'/%3E%3Ccircle cx='12' cy='5.5' r='2' fill='black'/%3E%3C/svg%3E");
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='3' stroke-linecap='square'/%3E%3C/svg%3E");
}

/* Type */
.display { margin: 0; font: 800 clamp(32px, 5vw, 56px)/1 var(--font-sign); letter-spacing: -.02em; }
.title { margin: 0; font: 800 24px/1.1 var(--font-sign); letter-spacing: -.01em; }
.label { font: 700 12px/1.3 var(--font-sign); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.caption { font: 500 13px/1.5 var(--font-sign); color: var(--muted); }
.link { color: var(--line-yellow); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.link:hover { color: var(--paper); }

/* Signage: a black band with the white rule near its top edge. */
.sign { position: relative; background: var(--sign); color: var(--paper); }
.sign::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--paper); pointer-events: none; }
.sign--yellow-rule::before { background: var(--line-yellow); }

/* Station mosaic band. */
.mosaic {
  height: 14px;
  border-top: 3px solid var(--mosaic-green);
  border-bottom: 3px solid var(--mosaic-green);
  background: conic-gradient(var(--mosaic-red) 25%, var(--mosaic-cream) 0 50%, var(--mosaic-red) 0 75%, var(--mosaic-cream) 0) 0 0 / 14px 14px;
}

/* The yellow tactile strip at the platform edge. */
.tactile {
  min-height: 16px;
  background-color: var(--line-yellow);
  background-image: radial-gradient(circle, var(--tactile-dot) 0 3px, transparent 3.6px);
  background-size: 16px 16px;
}

/* White subway tile wall. */
.tiles {
  background-color: var(--tile);
  background-image: linear-gradient(var(--tile-grout) 1px, transparent 1px), linear-gradient(90deg, var(--tile-grout) 1px, transparent 1px);
  background-size: 44px 22px;
  color: var(--ink);
}

/* A platform: concrete floor with the tactile edge on top. */
.platform { position: relative; padding-top: 16px; background: #1b1b1a; }
.platform::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 16px;
  background-color: var(--line-yellow);
  background-image: radial-gradient(circle, var(--tactile-dot) 0 3px, transparent 3.6px);
  background-size: 16px 16px;
}

/* Route bullets. */
.bullet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--line);
  color: #fff;
  font: 800 21px/1 var(--font-sign);
  font-style: normal;
}
.bullet--sm { width: 26px; height: 26px; font-size: 15px; }
.bullet--lg { width: 48px; height: 48px; font-size: 28px; }
.bullet--yellow { background: var(--line-yellow); color: var(--ink); }
.bullet--red { background: var(--line-red); }
.bullet--blue { background: var(--line-blue); }
.bullet--green { background: var(--line-green); }
.bullet--orange { background: var(--line-orange); }
.bullet--purple { background: var(--line-purple); }
.bullet--lime { background: var(--line-lime); color: var(--ink); }
.bullet--brown { background: var(--line-brown); }
.bullet--gray { background: var(--line-gray); color: var(--ink); }
/* Express diamond: the same letter, turned on its corner. */
.diamond {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin: 5px;
  background: var(--line);
  color: #fff;
  transform: rotate(45deg);
  font: 800 18px/1 var(--font-sign);
}
.diamond > * { transform: rotate(-45deg); }

/* Countdown clock: amber LED on a black board. */
.clock {
  font-family: var(--font-clock);
  font-weight: 400;
  color: var(--amber);
  text-shadow: 0 0 10px #ff9e1b88;
  letter-spacing: .04em;
  line-height: 1;
  text-transform: uppercase;
}
.clock--alert { animation: sw-blink 1.2s steps(2, jump-none) infinite; }
.clock-board {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: #000;
  box-shadow: inset 0 0 0 1px #2c2c2c;
}
.clock-board__label { font: 700 11px/1.2 var(--font-sign); letter-spacing: .14em; text-transform: uppercase; color: var(--paper); }
.clock-board .clock { font-size: 34px; }
@keyframes sw-blink { 50% { opacity: .25; } }

/* Icons: masks painted in currentColor. */
.icon { display: inline-block; flex: 0 0 auto; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--icon, var(--icon-arrow)) center / contain no-repeat; mask: var(--icon, var(--icon-arrow)) center / contain no-repeat; }
.icon--arrow { --icon: var(--icon-arrow); }
.icon--close { --icon: var(--icon-close); }
.icon--info { --icon: var(--icon-info); }
.icon--check { --icon: var(--icon-check); }

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-sizing: border-box;
  min-height: 48px;
  margin: 0;
  padding: 12px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font: 700 16px/1.15 var(--font-sign);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: translate .12s var(--ease), box-shadow .12s var(--ease), background-color .2s, color .2s;
}
.btn:focus-visible { outline: 3px solid var(--line-yellow); outline-offset: 4px; }
.btn:disabled { cursor: default; }
.btn--sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn--lg { min-height: 64px; padding: 14px 28px; font-size: 19px; }
.btn--block { display: flex; width: 100%; }

/* The departing arrow in an express diamond. */
.btn__diamond {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin: 0 4px;
  background: currentColor;
  transform: rotate(45deg);
  overflow: hidden;
}
.btn__diamond::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--diamond-fg, var(--line-yellow));
  -webkit-mask: var(--icon-arrow) center / 17px no-repeat;
  mask: var(--icon-arrow) center / 17px no-repeat;
  transform: rotate(-45deg);
  animation: sw-depart 4s ease-in-out infinite;
}
.btn:hover .btn__diamond::before, .btn.is-hover .btn__diamond::before { animation-duration: 1.1s; }
.btn:disabled .btn__diamond::before { animation: none; }
@keyframes sw-depart {
  0%, 72% { transform: rotate(-45deg) translate(0, 0); opacity: 1; }
  82% { transform: rotate(-45deg) translate(18px, 0); opacity: 0; }
  83% { transform: rotate(-45deg) translate(-18px, 0); opacity: 0; }
  94%, 100% { transform: rotate(-45deg) translate(0, 0); opacity: 1; }
}

/* Express: the primary action. Yellow plate on a platform edge. */
.btn--express {
  min-height: 60px;
  padding: 12px 26px 12px 16px;
  background: var(--line-yellow);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 0 6px 0 var(--express-edge), 0 6px 0 2px var(--ink), 0 18px 30px -12px #fccc0a66;
}
.btn--express::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 2px; background: var(--ink); }
.btn--express.btn--lg { min-height: 68px; }
.btn--express:hover:not(:disabled), .btn--express.is-hover {
  background: #ffd83a;
  translate: 0 -2px;
  box-shadow: 0 8px 0 var(--express-edge), 0 8px 0 2px var(--ink), 0 22px 36px -12px #fccc0a88;
}
.btn--express:active:not(:disabled), .btn--express.is-active {
  translate: 0 6px;
  box-shadow: 0 0 0 var(--express-edge), 0 0 0 2px var(--ink), 0 6px 12px -8px #fccc0a66;
}
.btn--express:disabled { background: #8a8676; color: #2b2a26; box-shadow: 0 6px 0 #4a4840, 0 6px 0 2px var(--ink); translate: none; --diamond-fg: #8a8676; }

/* Signage: the secondary action. */
.btn--sign { padding-top: 16px; background: var(--sign); color: var(--paper); box-shadow: inset 0 0 0 1px var(--sign-edge); --diamond-fg: var(--sign); }
.btn--sign::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 2px; background: var(--paper); transition: background-color .2s; }
.btn--sign:hover:not(:disabled), .btn--sign.is-hover { background: #1f1f1f; }
.btn--sign:hover:not(:disabled)::before, .btn--sign.is-hover::before { background: var(--line-yellow); }
.btn--sign:active:not(:disabled) { translate: 0 2px; }
.btn--sign:disabled { color: var(--faint); }

/* Tile: for light surfaces. */
.btn--tile { background: var(--tile); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink), inset 0 -4px 0 #d9d1bf; --diamond-fg: var(--tile); }
.btn--tile:hover:not(:disabled), .btn--tile.is-hover { background: var(--line-yellow); box-shadow: inset 0 0 0 2px var(--ink), inset 0 -4px 0 var(--tactile-dot); }
.btn--tile:active:not(:disabled) { translate: 0 2px; }
.btn--tile:disabled { opacity: .5; }

/* Line: quiet outline. */
.btn--line { min-height: 44px; padding: 10px 18px; color: var(--paper); box-shadow: inset 0 0 0 2px var(--paper); font-size: 14px; --diamond-fg: var(--ink); }
.btn--line:hover:not(:disabled), .btn--line.is-hover { background: var(--paper); color: var(--ink); --diamond-fg: var(--paper); }
.btn--line:active:not(:disabled) { translate: 0 1px; }
.btn--line:disabled { opacity: .45; }

/* Icon: square, 44px. Put an .icon inside and an aria-label on the button. */
.btn--icon { width: 44px; height: 44px; min-height: 0; padding: 0; gap: 0; flex: 0 0 auto; background: var(--sign); color: var(--paper); box-shadow: inset 0 0 0 2px var(--paper); }
.btn--icon:hover:not(:disabled), .btn--icon.is-hover, .btn--icon[aria-expanded="true"] { background: var(--line-yellow); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line-yellow); }
.btn--icon:active:not(:disabled) { translate: 0 1px; }

/* Pins: a label stuck to a spot in the 3D scene or on an image.
   Put .pin inside a position: relative parent and set left/top to the spot; the dot lands on it.
   .pin--tag drops the dot and stem and centres the tag on the spot instead. .pin--up hangs the tag above.
   .pin-tag--price drops the words and leaves only the price chip.
   Customize with --pin (accent: dot, price, hover edge), --pin-stem (stem length) and --pin-dot (dot size). */
.pin { --pin-dot: 10px; position: absolute; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, calc(var(--pin-dot) / -2)); pointer-events: none; }
.pin > * { pointer-events: auto; }
.pin--tag { transform: translate(-50%, -50%); }
.pin--up { flex-direction: column-reverse; transform: translate(-50%, calc(var(--pin-dot) / 2 - 100%)); }
.pin__dot { flex: 0 0 auto; box-sizing: border-box; width: var(--pin-dot); height: var(--pin-dot); border: 2px solid var(--ink); border-radius: 50%; background: var(--pin, var(--line-yellow)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin, var(--line-yellow)) 25%, transparent); }
.pin__stem { width: 2px; height: var(--pin-stem, 14px); background: var(--paper); }
.pin-tag {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0; padding: 4px 4px 4px 8px; border: 0; border-radius: 0;
  background: #121212e6; color: var(--paper);
  font: 700 11px/1.2 var(--font-sign); white-space: nowrap; text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--sign-edge);
  cursor: pointer; transition: box-shadow .15s var(--ease), transform .15s var(--ease);
}
.pin-tag:hover, .pin-tag.is-hover { box-shadow: inset 0 0 0 1px var(--pin, var(--line-yellow)); transform: translateY(-1px); }
.pin-tag:focus-visible { outline: 2px solid var(--pin, var(--line-yellow)); outline-offset: 2px; }
.pin-tag__price { padding: 2px 5px; background: var(--pin, var(--line-yellow)); color: var(--ink); font-size: 10px; font-weight: 800; }
.pin-tag--price { padding: 0; background: transparent; box-shadow: none; cursor: default; }
.pin-tag--price:hover, .pin-tag--price.is-hover { box-shadow: none; transform: none; }

/* Strip map: a route line with a stop per choice. */
.strip { display: flex; flex-direction: column; }
.stop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 12px 10px 56px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font: 600 16px/1.2 var(--font-sign);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s;
}
.stop::before { content: ""; position: absolute; left: 21px; top: 0; bottom: 0; width: 6px; background: var(--line); }
.stop:first-child::before { top: 50%; }
.stop:last-child::before { bottom: 50%; }
.stop:only-child::before { display: none; }
.stop::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--paper);
  border: 4px solid var(--ink);
  transition: transform .2s var(--ease), background-color .2s;
}
.stop:hover, .stop.is-hover { background: var(--sign-2); }
.stop:hover::after, .stop.is-hover::after, .stop[aria-current]::after { transform: scale(1.25); background: var(--line-yellow); }
.stop:focus-visible { outline: 3px solid var(--line-yellow); outline-offset: -3px; }
.stop__name { flex: 1; min-width: 0; }
.stop__sub { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
.price-tag { flex: 0 0 auto; padding: 6px 9px; background: var(--line-yellow); color: var(--ink); font: 800 13px/1 var(--font-sign); letter-spacing: .02em; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font: 600 13px/1.3 var(--font-sign); }
.input, .field input, .field textarea, .field select {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: var(--tile);
  color: var(--ink);
  font: 500 16px/1.3 var(--font-sign);
  box-shadow: inset 0 0 0 1px var(--tile-edge);
}
.field textarea { padding: 12px 14px; min-height: 96px; resize: vertical; }
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: #8b8474; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid var(--line-yellow); outline-offset: 0; }
.field input:user-invalid { box-shadow: inset 0 0 0 2px var(--danger); }
.check { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font: 500 13px/1.45 var(--font-sign); cursor: pointer; }
.check input {
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 2px solid var(--paper);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}
.check input:checked { background: var(--line-yellow) var(--icon-check) center / 16px no-repeat; border-color: var(--line-yellow); }
.check input:focus-visible { outline: 3px solid var(--line-yellow); outline-offset: 2px; }
.check a { color: var(--line-yellow); }

/* Panels */
.scrim { position: fixed; inset: 0; background: #000000b3; }
.panel {
  position: relative;
  box-sizing: border-box;
  padding: 24px 20px 22px;
  background: var(--sign);
  color: var(--paper);
  font-family: var(--font-sign);
  box-shadow: 0 0 0 1px var(--sign-edge), 0 30px 80px #000c;
}
.panel::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--paper); }
.panel__head { display: flex; align-items: center; gap: 10px; }
.panel__title { flex: 1; min-width: 0; margin: 0; font: 800 22px/1.15 var(--font-sign); letter-spacing: -.01em; }
.notice { padding: 12px 14px; background: var(--sign-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--sign-edge); font: 500 13px/1.5 var(--font-sign); }
.notice a { color: var(--line-yellow); }

@media (prefers-reduced-motion: reduce) {
  .btn, .stop, .stop::after, .btn--sign::before { transition: none !important; }
  .btn__diamond::before, .clock--alert { animation: none !important; }
}
