/*
 * Tipple — tipple.sg
 *
 * THE TOKEN RULE APPLIES HERE TOO. Every value below the :root block is a
 * var(). The values inside :root are copied from src/theme/tokens.ts and are
 * the only place a literal appears. This file cannot import the TypeScript
 * tokens — it ships as static CSS with no build step, which is the point — so
 * the duplication is deliberate and confined to one block.
 *
 * IT IS A WEBSITE, NOT THE APP. The app's chrome does not belong here: no
 * pills, no chips, no rounded cards stacked in a grid. Structure comes from
 * type size, vertical rhythm and hairline rules, which is how a page is built
 * rather than how a screen is. The one exception is form controls, which have
 * to look like controls to be usable.
 *
 * DARK ONLY, DELIBERATELY. The app ships dark, light mode is built but not
 * shipped, and this reads as a bar at night. `color-scheme: dark` makes the
 * browser render controls and scrollbars to match rather than punching white
 * holes in the page.
 */

:root {
  /* Surfaces — palette.void / abyss / card / surface */
  --void: #141418;
  --abyss: #1e1e24;
  --card: #2d2d34;
  --surface: #3a3a43;
  --raised: #484854;
  --control-border: #7e7e90;

  /* Text — palette.textHero down to textSecondary.
     textTertiary #6E6277 is deliberately absent; see the contrast note below. */
  --text-hero: #f0eef5;
  --text-primary: #c8c6d4;
  --text-secondary: #9d8ca1;

  /* Brand amber */
  --amber-100: #fff3e0;
  --amber-300: #ffd199;
  --amber-500: #ffa737;
  --amber-700: #b86c00;
  --amber-900: #6b3a00;

  /* Status */
  --error: #f02d3a;
  --error-bg: #4a1c1c;
  --success: #22c55e;

  /* space.xs → space.xxxl */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-base: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-xxxl: 40px;

  /* radius.sm / button. Nothing here needs card or sheet radius any more. */
  --radius-sm: 6px;
  --radius-button: 10px;

  /* font.size — the app scale. The two display steps are web only: a headline
     that has to work at arm's length on a phone and across a desktop needs
     range the app has no use for. Marked so nobody backports them. */
  --text-micro: 11px;
  --text-caption: 13px;
  --text-body: 15px;
  --text-body-lg: 17px;
  --text-title: 20px;
  --text-heading: 24px;
  --text-hero-size: 28px;
  --text-ask: clamp(30px, 5.6vw, 52px); /* web only — the question */
  /* web only — the blank you type into. Sized so the full placeholder,
     "Nominate your favourite bar", sits on one line at 375px. */
  --text-answer: clamp(21px, 3.6vw, 32px);

  --tracking-label: 1.2px;
  --leading-tight: 1.1;
  --leading-normal: 1.45;
  --leading-relaxed: 1.6;

  /* size.touchTarget — non-negotiable, both stores check it and so does WCAG */
  --touch-target: 44px;

  --measure: 60ch;
  --page-max: 940px;

  color-scheme: dark;
}

/* --------------------------------------------------------------------- */
/* Reset                                                                  */
/* --------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--text-primary);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--text-body-lg);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--amber-500);
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--amber-500);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/*
 * CONTRAST NOTE, and the reason --text-tertiary is not defined above.
 *
 * textTertiary #6E6277 is 3.22:1 on --void and 2.90:1 on --abyss. In the app it
 * marks dimmed glyphs, where 3:1 is the bar. Everywhere it would have gone on
 * this page is real sentence text at 13px — fine print, the footer's 18+ line —
 * and that needs 4.5:1. Those take --text-secondary: 5.86:1 on --void, 5.29:1
 * on --abyss. A step brighter than the design would suggest, and the
 * alternative was fine print nobody can read, on a page whose fine print is a
 * PDPA statement.
 */

/* --------------------------------------------------------------------- */
/* Shell                                                                  */
/* --------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--space-xl);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--space-sm);
  background: var(--card);
  color: var(--text-hero);
  padding: var(--space-md) var(--space-base);
  border-radius: var(--radius-button);
  z-index: 100;
}

.skip-link:focus {
  left: var(--space-base);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-base);
  padding-block: var(--space-lg);
}

/* The member page has no nav wordmark, so its one link sits right on its own. */
.nav--end {
  justify-content: flex-end;
}

/* The wordmark is artwork, not type. Both files are white on transparency at
   1176x528; width drives it and height follows, so a re-export at a different
   ratio cannot stretch it. */
.logo {
  width: 108px;
  height: auto;
}

/*
 * min-width: 0 so the wordmark can give way to the link beside it. A flex item
 * defaults to min-width: auto, which for an image is its own width — so at
 * 375px the wordmark held its full size and pushed the boxed link off the
 * right edge. Shrinking is the correct answer rather than a smaller vw factor:
 * it holds at 320px too, and needs no number tuned per device.
 */
.logo--hero {
  width: min(340px, 68vw);
  min-width: 0;
}

/*
 * The wordmark and the "For bars" link on one row, top-aligned. flex-start is
 * what puts the link level with the top of the mark, and keeps it there at
 * every width without a magic offset to maintain.
 */
.hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-base);
  margin-bottom: var(--space-xxl);
}

a.logo-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
}

/*
 * Amber, not secondary text: it is the only way across to the other side of
 * the site, and it was reading as a caption.
 *
 * An outlined version of .button: same radius, same amber, border instead of
 * fill. radius-button rather than radius-pill deliberately — a full pill is the
 * app's chip shape, and the eyebrow that got cut for looking like app chrome.
 *
 * The border is amber-500 rather than a dimmer step so it reads as the outline
 * of a control rather than a faint box. 9.48:1 on --void, well past the 3:1 a
 * control boundary needs.
 */
.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  padding-inline: var(--space-xl);
  border: 1px solid var(--amber-500);
  border-radius: var(--radius-button);
  color: var(--amber-500);
  font-size: var(--text-body);
  font-weight: 500;
  text-decoration: none;
  /* Two words in a box narrow enough to break them. Safe to pin here in a way
     it was not on the primary button: the longest label is "For members", which
     is 85px wide and cannot push a 320px page sideways. */
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.nav__link:hover {
  background: rgba(255, 167, 55, 0.1);
  border-color: var(--amber-500);
  color: var(--amber-300);
}

/* --------------------------------------------------------------------- */
/* The ask — the page's one idea                                          */
/*                                                                        */
/* Members nominate, bars decide. So the first thing on the page is not an */
/* email field, it is a bar name, and the control is a ruled blank rather  */
/* than a boxed input — a form to fill in, not an app to operate.          */
/* --------------------------------------------------------------------- */

.hero {
  padding-block: clamp(var(--space-xl), 6vw, 72px) clamp(var(--space-xxxl), 8vw, 88px);
}

.ask {
  max-width: 17ch;
  color: var(--text-hero);
  font-size: var(--text-ask);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.ask em {
  font-style: normal;
  color: var(--amber-500);
}

.lede {
  max-width: 48ch;
  margin-top: var(--space-lg);
  color: var(--text-secondary);
  font-size: var(--text-body-lg);
  line-height: var(--leading-relaxed);
}

/* The blank. Underline only — no box, no fill, no radius. */
.blank {
  display: block;
  width: 100%;
  margin-top: var(--space-xxl);
  padding: var(--space-sm) 0;
  background: none;
  border: none;
  border-bottom: 2px solid var(--control-border);
  border-radius: 0;
  color: var(--text-hero);
  font: inherit;
  font-size: var(--text-answer);
  font-weight: 600;
  letter-spacing: -0.015em;
  transition: border-color 0.18s ease;
}

.blank::placeholder {
  color: var(--text-secondary);
  font-weight: 400;
}

.blank:hover {
  border-bottom-color: var(--raised);
}

.blank:focus {
  border-bottom-color: var(--amber-500);
  outline: none;
}

/* The focus ring would sit miles from a bare underline, so the underline is
   the focus indicator and this restores a visible one for keyboard users. */
.blank:focus-visible {
  border-bottom-color: var(--amber-500);
  box-shadow: 0 2px 0 0 var(--amber-500);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-base) var(--space-xl);
  margin-top: var(--space-xl);
}

/* --------------------------------------------------------------------- */
/* Steps                                                                  */
/* --------------------------------------------------------------------- */

.step[hidden] {
  display: none;
}

.step__lead {
  max-width: 24ch;
  color: var(--text-hero);
  font-size: clamp(var(--text-heading), 3.6vw, 34px);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.step__lead strong {
  color: var(--amber-500);
  font-weight: 700;
}

.step__body {
  max-width: 46ch;
  margin-top: var(--space-base);
  color: var(--text-secondary);
  font-size: var(--text-body-lg);
  line-height: var(--leading-relaxed);
}

.form-block {
  max-width: 460px;
  margin-top: var(--space-xxl);
}

/* --------------------------------------------------------------------- */
/* Controls                                                               */
/* --------------------------------------------------------------------- */

.field {
  display: block;
  margin-bottom: var(--space-base);
}

.field__label {
  display: block;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.field__optional {
  color: var(--text-secondary);
  font-weight: 400;
}

.input {
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-md) var(--space-base);
  background: var(--abyss);
  color: var(--text-hero);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-button);
  font: inherit;
  font-size: var(--text-body);
  transition: border-color 0.18s ease;
}

.input::placeholder {
  color: var(--text-secondary);
}

.input:hover {
  border-color: var(--raised);
}

.input:focus {
  border-color: var(--amber-500);
}

textarea.input {
  min-height: 96px;
  resize: vertical;
}

/* Off-canvas rather than display:none, because some bots skip fields that are
   explicitly hidden. aria-hidden and tabindex keep it away from anyone using a
   screen reader or a keyboard. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/*
 * The label is the touch target, not the box. A checkbox is a replaced element
 * so a ::before on it to grow the hit area does not render, but the label wraps
 * both the box and its text and is clickable across its width — giving the
 * label the 44px height is what actually satisfies size.touchTarget.
 */
.check {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: var(--touch-target);
  margin-bottom: var(--space-lg);
  cursor: pointer;
}

.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--amber-500);
}

.check span {
  color: var(--text-primary);
  font-size: var(--text-body);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px; /* size.buttonHeight */
  padding-inline: var(--space-xxl);
  background: var(--amber-500);
  /* On amber, 9.27:1. The one literal outside :root, and it exists because no
     token in the app sits on a fill. */
  color: #241300;
  border: none;
  border-radius: var(--radius-button);
  font: inherit;
  font-size: var(--text-body-lg);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease;
}

.button--wide {
  width: 100%;
}

.button:hover {
  background: var(--amber-300);
}

.button[disabled] {
  opacity: 0.55;
  cursor: progress;
}

/* The second choice beside a filled button: .nav__link's outline at button size. */
.button--outline {
  background: none;
  border: 1px solid var(--amber-500);
  color: var(--amber-500);
}

.button--outline:hover {
  background: rgba(255, 167, 55, 0.1);
  color: var(--amber-300);
}

/* A text link that happens to sit next to a button. */
.link-action {
  color: var(--text-secondary);
  font-size: var(--text-body);
  /* Wraps to several lines, so it needs a line-height of its own — a button
     does not inherit body's, and at the default the lines collide. */
  line-height: var(--leading-normal);
  text-align: left;
  /* A sentence rather than a label now. Held to a readable measure so it does
     not run the full width of a desktop page beside the button. */
  max-width: 38ch;
  text-decoration: underline;
  text-decoration-color: var(--surface);
  background: none;
  border: none;
  padding: 0;
  min-height: var(--touch-target);
  font-family: inherit;
  cursor: pointer;
}

.link-action:hover {
  color: var(--amber-500);
  text-decoration-color: var(--amber-500);
}

.fineprint {
  max-width: 46ch;
  margin-top: var(--space-base);
  color: var(--text-secondary);
  font-size: var(--text-caption);
  line-height: var(--leading-normal);
}

/*
 * An error block, not red text. --error #F02D3A is 4.06:1 on --abyss, which
 * fails 4.5:1, and there is no lighter red in the palette to reach for — the
 * app never puts error text on a dark surface. Rather than invent a colour,
 * this uses two tokens that already exist: errorBg as the fill and textHero as
 * the text, at 12.38:1. --error stays as the marker down the edge, where it
 * only has to be seen rather than read.
 */
.form-error {
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-base);
  border-left: 3px solid var(--error);
  border-radius: var(--radius-sm);
  background: var(--error-bg);
  color: var(--text-hero);
  font-size: var(--text-body);
}

.form-error:empty {
  display: none;
}

/* A live count read back to a venue while they fill the form in. */
.tally {
  margin-top: var(--space-sm);
  color: var(--amber-300);
  font-size: var(--text-body);
  font-weight: 600;
}

.tally:empty {
  display: none;
}

/* --------------------------------------------------------------------- */
/* Sections — hairline rules, not cards                                   */
/* --------------------------------------------------------------------- */

.rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--card);
}

.terms {
  padding-block: clamp(var(--space-xxl), 6vw, 64px);
  display: grid;
  gap: var(--space-xxl);
}

.term {
  display: grid;
  gap: var(--space-sm);
  max-width: var(--measure);
}

.term__title {
  color: var(--text-hero);
  font-size: var(--text-heading);
  font-weight: 700;
  letter-spacing: -0.015em;
}

.term__body {
  color: var(--text-secondary);
  font-size: var(--text-body-lg);
  line-height: var(--leading-relaxed);
}

/* The venue page's last section: the way through to the member page. */
.closing {
  display: grid;
  gap: var(--space-sm);
  max-width: var(--measure);
  padding-block: clamp(var(--space-xxl), 6vw, 64px);
}

.closing .hero__actions {
  margin-top: var(--space-base);
}

@media (min-width: 720px) {
  /* The heading sits in a left column and the explanation in a wider right
     one, so the three read as a list of terms rather than three boxes. */
  .term {
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: var(--space-xl);
    align-items: start;
    max-width: none;
  }
}

/* --------------------------------------------------------------------- */
/* Footer                                                                 */
/* --------------------------------------------------------------------- */

.footer {
  padding-block: var(--space-xxl) var(--space-xxxl);
  color: var(--text-secondary);
  font-size: var(--text-caption);
}

.footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-base);
  margin-bottom: var(--space-lg);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xl);
}

/* The footer's cross-link carries .nav__link, so it is the same outlined
   control as the one in the header rather than a second, quieter treatment of
   the same journey. Nothing left to style here. */

/* Privacy and Terms, quietly, under the footer note. */
.footer__legal {
  margin-top: var(--space-sm);
  font-size: var(--text-caption);
}

.footer__legal a {
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------- */
/* Legal pages: long-form reading, so the measure and rhythm of a page    */
/* rather than a form. privacy.html, terms.html.                          */
/* --------------------------------------------------------------------- */

.legal {
  max-width: var(--measure);
  padding-block: var(--space-xxl) var(--space-xxxl);
  color: var(--text-primary);
  font-size: var(--text-body);
  line-height: var(--leading-relaxed);
}

.legal h1 {
  color: var(--text-hero);
  font-size: var(--text-heading);
  line-height: var(--leading-tight);
}

.legal h2 {
  margin-top: var(--space-xxl);
  color: var(--text-hero);
  font-size: var(--text-title);
  line-height: var(--leading-tight);
}

.legal p,
.legal ul {
  margin-top: var(--space-md);
}

.legal ul {
  padding-left: var(--space-xl);
}

.legal li + li {
  margin-top: var(--space-sm);
}

.legal a {
  color: var(--amber-500);
}

.legal .updated {
  margin-top: var(--space-sm);
  color: var(--text-secondary);
  font-size: var(--text-caption);
}

.footer__note {
  max-width: var(--measure);
  line-height: var(--leading-relaxed);
}

/* --------------------------------------------------------------------- */
/* Narrow                                                                 */
/* --------------------------------------------------------------------- */

@media (max-width: 640px) {
  .wrap {
    padding-inline: var(--space-base);
  }

  .ask {
    max-width: none;
  }

  .hero__actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
