// Country editions — /italy/ and /united-states/ set window.EDITION before loading scripts.
// The home page sets nothing and renders the default (global) edition.

const US_GUIDE = {
  id: "united-states",
  image: "/images/united-states.png",
  country: "United States",
  region: "North America",
  headline: "Four-way stops, right on red, and a country measured in hours",
  cover: "desert highway · late afternoon",
  coverHue: "warm",
  issue: "№ 11",
  readTime: "10 min",
  bySide: "Right",
  speed: "55–80 mph highway · 25 in town",
  bac: "0.08% (0.05% Utah)",
  idp: "Recommended",
  fuel: "$3.40 / gal",
  drivenBy: "Dana Whitfield",
  dateline: "Las Vegas → Zion · Spring 2026",
  excerpt:
    "American roads are wide, well-signed, and forgiving right up until they aren't. Every state writes its own rulebook, the speed limit changes at the county line, and the nearest fuel can be ninety miles of desert away.",
  sections: [
    {
      kind: "lede",
      body:
        "There is no single American highway code. There are fifty of them, plus the District of Columbia, and they agree on most things and quietly disagree on the ones that cost you money: whether you can turn right on a red light, how fast the interstate runs, whether your foreign licence alone is enough at a traffic stop."
    },
    {
      kind: "rules",
      title: "What the law actually requires",
      items: [
        ["Licence", "Most states honour a valid foreign licence for visitors. An IDP is not always required, but it is a translation officers and rental desks recognise — carry one if your licence isn't in English."],
        ["Speed", "Posted in mph, set by each state. Interstates run 65–75; parts of Texas allow 80–85. School zones drop to 15–25 when lights flash."],
        ["Right on red", "Legal after a full stop almost everywhere, unless a sign says NO TURN ON RED. Banned citywide in New York City."],
        ["School buses", "Red lights flashing and stop arm out means every lane stops — both directions, unless a median divides the road."],
        ["Phone", "Handheld use is banned in most states. Texting while driving is banned in nearly all of them."]
      ]
    },
    {
      kind: "prose",
      title: "The four-way stop",
      body:
        "An intersection with a stop sign on every corner. First to arrive, first to go. Arrive together and the car on the right goes first. Stop fully behind the white line — a rolling stop is the single most common ticket visitors collect, and the police car waiting across the intersection is not a coincidence."
    },
    {
      kind: "pull",
      text: "In America you don't ask how far it is. You ask how long it takes, and the answer is always longer than the map suggests."
    },
    {
      kind: "prose",
      title: "If you are pulled over",
      body:
        "Pull to the right shoulder, turn off the engine, switch on the interior light at night, and keep both hands on the wheel. Do not get out. Do not reach for documents until the officer asks. Hand over licence, IDP, and rental agreement together. Calm and slow is the whole etiquette."
    },
    {
      kind: "routes",
      title: "Three drives worth the rental",
      items: [
        {
          name: "Highway 1 — Pacific Coast",
          from: "Monterey",
          to: "San Luis Obispo",
          hours: "3.5",
          note: "Big Sur has no fuel for long stretches and slides close sections every winter. Check Caltrans before leaving."
        },
        {
          name: "US-89 — Utah Parks",
          from: "Zion",
          to: "Bryce Canyon",
          hours: "2.0",
          note: "The Zion–Mount Carmel tunnel needs an escort for RVs. Arrive before 8am or queue behind them."
        },
        {
          name: "Blue Ridge Parkway",
          from: "Waynesboro",
          to: "Asheville",
          hours: "8.0",
          note: "45 mph limit, no trucks, no billboards. October leaf season doubles the drive time — plan for it."
        }
      ]
    },
    {
      kind: "warning",
      title: "Don't",
      items: [
        "Don't pass a stopped school bus with its stop arm out. It is among the most expensive tickets in the country.",
        "Don't drive into a toll road without checking how the rental bills it — many are cashless and the fees stack.",
        "Don't let the tank drop below a quarter in Nevada, Utah or Arizona. The next station may be two hours away."
      ]
    }
  ]
};

const EDITIONS = {
  italy: {
    lead: "italy",
    title: "italicense — Driving in Italy",
    vol: "Italian Edition · Spring & Summer · 2026",
    tagline: "Filed from Florence, Naples and the Stelvio",
    kicker: "Driving guides · Italian edition",
    h1: ["How to drive", "Italy like you", "have driven it before."],
    sub: "ZTL cameras, autostrada tolls, reflective vests in the cabin, and the roads the locals would take if they had a guest in the passenger seat.",
    aside: [
      <p key="a"><strong>italicense</strong> started in Italy — on a stradina between cypress trees, with a rental Panda and a ZTL fine that arrived six months later. This edition leads with the country that named us.</p>,
      <p key="b">Our Italy guide is written by a Florentine driver and checked against the Codice della Strada the week we publish it. Nine more countries follow.</p>
    ],
    cta: "Read the Italy guide ↓",
    ticker: [
      "ITALY · ZTL fines arrive six months later",
      "AUTOSTRADA · the left lane is for passing",
      "VESTS · one per occupant, inside the cabin",
      "IDP · required alongside your home licence",
      "HEADLIGHTS · dipped beams on outside towns",
      "AMALFI · a Panda is the correct size",
      "STELVIO · 48 hairpins, open June–October",
      "TELEPASS · yellow lanes only with a transponder"
    ]
  },
  "united-states": {
    lead: "united-states",
    extraGuides: [US_GUIDE],
    title: "italicense — Driving in the United States",
    vol: "American Edition · Spring & Summer · 2026",
    tagline: "Filed from Route 66, Big Sur and the Blue Ridge",
    kicker: "Driving guides · American edition",
    h1: ["How to drive", "fifty states that", "don't agree on the rules."],
    sub: "Four-way stops, right on red, school buses, mph and gallons — and the long roads locals would take if they had a guest in the passenger seat.",
    aside: [
      <p key="a"><strong>italicense</strong> is a quiet publication for travellers who would rather drive themselves — across Utah's parks, down the Pacific Coast, over the Blue Ridge — and arrive understanding the road.</p>,
      <p key="b">Our American guide is written by a long-haul driver and checked against state law the week we publish it. It tells you what the rental-car counter won't.</p>
    ],
    cta: "Read the United States guide ↓",
    ticker: [
      "USA · every state writes its own rules",
      "FOUR-WAY STOP · first to arrive, first to go",
      "RIGHT ON RED · legal, except in New York City",
      "SCHOOL BUS · stop arm out, every lane stops",
      "SPEED · posted in mph, set by the state",
      "UTAH · 0.05% BAC, the strictest in the country",
      "TOLLS · cashless roads bill the rental",
      "DESERT · fill up at a quarter tank"
    ]
  }
};

const EDITION = EDITIONS[window.EDITION] || null;

// Put the edition's lead country first, adding any edition-only guides.
if (EDITION) {
  (EDITION.extraGuides || []).forEach(g => GUIDES.push(g));
  const i = GUIDES.findIndex(g => g.id === EDITION.lead);
  if (i > 0) GUIDES.unshift(GUIDES.splice(i, 1)[0]);
  document.title = EDITION.title;
}
