:root{
  --ink:#171512; --dim:#5f564a; --line:#e4dccd; --bg:#fbf9f4; --card:#fff;
  --accent:#7a3d16; --accent-soft:#f4ecdd; --shadow:0 10px 40px rgba(30,20,8,.16);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font:17px/1.55 -apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
.wrap{max-width:760px; margin:0 auto; padding:28px 18px 90px}
header.site{display:flex; align-items:baseline; justify-content:space-between; gap:16px;
  flex-wrap:wrap; padding-bottom:14px; border-bottom:1px solid var(--line); margin-bottom:26px;
  font-size:14px}
header.site .who{font-family:Georgia,"Times New Roman",serif; font-size:17px}
a{color:var(--accent); text-decoration:none; border-bottom:1px solid #d8c3a8}
h1{font-family:Georgia,"Times New Roman",serif; font-weight:400; font-size:clamp(26px,5.5vw,36px);
   margin:0 0 6px; letter-spacing:-.01em}
.sub{color:var(--dim); font-size:15px; margin:0 0 22px}

/* ---- language switch (bilingual sheets only) ------------------------------
   Rendered hidden for every old sheet via the hidden attribute, so nothing here
   changes what motorbike.json or vehicles.json look like. Two thumb-sized
   buttons, pressed state carried by aria-pressed for screen readers too. */
.langswitch{display:flex; gap:8px; margin:-10px 0 20px}
.langswitch[hidden]{display:none}
.langswitch button{
  min-width:64px; min-height:44px; padding:0 16px;
  font-family:inherit; font-size:14px; font-weight:650; letter-spacing:.06em;
  color:var(--dim); background:var(--card);
  border:1px solid var(--line); border-radius:999px; cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.langswitch button:hover{color:var(--ink); border-color:#cdbfa6}
.langswitch button:focus-visible{outline:2px solid var(--accent); outline-offset:2px}
.langswitch button[aria-pressed="true"]{
  background:var(--accent); border-color:var(--accent); color:#fff}

/* ---- section nav ---------------------------------------------------------
   Section names are long ("Asking for exactly the part you want"), so a wrapped
   row would become a tall block on a phone. It never wraps: it is one line that
   scrolls sideways, fading at the edge that still has more behind it. Sticky, so
   the reader can jump again from anywhere in a 115-card page. */
.secnav{
  position:sticky; top:0; z-index:20;
  margin:0 0 18px; padding:3px 0;
  background:var(--bg); border-bottom:1px solid var(--line);
}
.secnav[hidden]{display:none}
/* While a flash card is up. #card is a fixed overlay at z-index 50, so this is
   about the keyboard rather than the pixels: ten chips must not stay in the tab
   order behind an open dialog. */
.secnav.behind{visibility:hidden}
.secnav .strip{
  --fade:none;
  display:flex; flex-wrap:nowrap; gap:7px;
  overflow-x:auto; overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain;      /* a sideways flick stops here, not at page-back */
  scrollbar-width:none;
  -webkit-mask-image:var(--fade); mask-image:var(--fade);
}
.secnav .strip::-webkit-scrollbar{display:none}
.secnav.fade-right .strip{--fade:linear-gradient(to right,#000 calc(100% - 30px),transparent)}
.secnav.fade-left .strip{--fade:linear-gradient(to left,#000 calc(100% - 30px),transparent)}
.secnav.fade-left.fade-right .strip{
  --fade:linear-gradient(to right,transparent,#000 30px,#000 calc(100% - 30px),transparent)}
.secnav .chip{
  flex:0 0 auto; white-space:nowrap;
  font-family:inherit; font-size:12.5px; line-height:1.2;
  letter-spacing:.05em; text-transform:uppercase;
  color:var(--dim); background:var(--card);
  border:1px solid var(--line); border-radius:999px;
  padding:7px 12px; cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.secnav .chip:hover{color:var(--ink); border-color:#cdbfa6}
.secnav .chip:active{background:var(--accent-soft)}
.secnav .chip:focus-visible{outline:2px solid var(--accent); outline-offset:2px}
.secnav .chip[aria-current="true"]{
  background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600}

/* The collapsed row: on a phone the chip strip is the wrong instrument (ten long
   names, four of them off the right edge, no idea how many). One row that spells
   out where you are, and opens the drawer. It still shows state unopened. */
.secnav .compact{
  display:none; justify-content:flex-start; align-items:center; gap:7px;
  width:100%; min-height:30px; margin:0; padding:0 10px;
  background:var(--card); border:1px solid var(--line); border-radius:8px;
  font-family:inherit; font-size:13px; line-height:1.2;
  color:var(--ink); text-align:left; cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.secnav .compact .pos{flex:0 0 auto; font-size:11px; letter-spacing:.08em;
  text-transform:uppercase; color:var(--dim)}
.secnav .compact .sep{flex:0 0 auto; color:var(--dim)}
.secnav .compact .cur{flex:1 1 auto; min-width:0; overflow:hidden;
  text-overflow:ellipsis; white-space:nowrap; font-weight:600}
.secnav .compact .chev{flex:0 0 auto; font-size:10px; color:var(--dim)}
.secnav .compact:focus-visible{outline:2px solid var(--accent); outline-offset:2px}

/* 720px is the site's own column width: below it the strip gives way to the row. */
@media (max-width:719px){
  .secnav .strip{display:none}
  .secnav .compact{display:flex}
}

/* ---- the drawer ---- */
.navdrawer{
  position:fixed; inset:0; z-index:30;               /* over the bar (20), under #card (50) */
  visibility:hidden; pointer-events:none;
  transition:visibility 0s linear .24s;              /* stay visible until the slide-out ends */
}
.navdrawer.open{visibility:visible; pointer-events:auto; transition-delay:0s}
.navdrawer .scrim{position:absolute; inset:0; background:rgba(23,21,18,.44);
  opacity:0; transition:opacity .2s ease}
.navdrawer.open .scrim{opacity:1}
.navdrawer .panel{
  position:absolute; top:0; bottom:0; left:0; width:min(86vw,340px); max-width:100%;
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--bg); border-right:1px solid var(--line); box-shadow:var(--shadow);
  padding:max(10px,env(safe-area-inset-top)) 0 max(10px,env(safe-area-inset-bottom));
  transform:translateX(-100%); transition:transform .22s cubic-bezier(.2,.7,.3,1);
}
.navdrawer.open .panel{transform:none}
.navdrawer .head{padding:0 18px 10px; font-size:11px; letter-spacing:.1em;
  text-transform:uppercase; color:var(--dim); border-bottom:1px solid var(--line)}
.navdrawer .list{flex:1; min-height:0; display:flex; flex-direction:column;
  overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain}
.navdrawer .item{
  flex:0 0 auto; display:flex; align-items:center; gap:12px;
  width:100%; min-height:48px; padding:10px 18px;      /* comfortably tappable */
  border:0; border-bottom:1px solid #f0e9da; background:none;
  font-family:inherit; font-size:15px; line-height:1.35; color:var(--ink);
  text-align:left; cursor:pointer; -webkit-tap-highlight-color:transparent;
}
.navdrawer .item .n{flex:0 0 1.4em; font-size:11.5px; letter-spacing:.06em;
  color:var(--dim); font-variant-numeric:tabular-nums}
.navdrawer .item .t{flex:1 1 auto; min-width:0}
.navdrawer .item:active{background:var(--accent-soft)}
.navdrawer .item:focus-visible{outline:2px solid var(--accent); outline-offset:-2px}
.navdrawer .item[aria-current="true"]{background:var(--accent-soft)}
.navdrawer .item[aria-current="true"] .n{color:var(--accent); font-weight:700}
.navdrawer .item[aria-current="true"] .t{font-weight:650}
/* Top is pinned under the list, not inside it: on a short phone the list scrolls
   and the way back to the index must not be the one item below the fold. */
.navdrawer .foot{flex:0 0 auto; border-top:1px solid var(--line)}
.navdrawer .list .item:last-child{border-bottom:0}
.navdrawer .item.top{border:0; color:var(--accent); font-size:14px}

@media (prefers-reduced-motion: reduce){
  .navdrawer, .navdrawer .scrim, .navdrawer .panel{transition:none}
}

.tip{background:var(--accent-soft); border:1px solid #e8d7b6; border-radius:12px;
     padding:12px 14px; font-size:14px; margin:0 0 26px}

h2{font-size:13px; text-transform:uppercase; letter-spacing:.1em; color:var(--accent);
   margin:30px 0 8px; padding-bottom:6px; border-bottom:2px solid var(--line)}
/* A heading focused by a chip tap is a jump target, not a tab stop: the scroll
   itself is the indication, so no ring around the whole section title. */
h2:focus{outline:none}

.rows{background:var(--card); border:1px solid var(--line); border-radius:12px; overflow:hidden}
.row{display:grid; grid-template-columns:1.15fr 1.15fr .9fr; gap:10px; align-items:baseline;
     padding:11px 14px; border-bottom:1px solid #f0e9da; cursor:pointer; -webkit-tap-highlight-color:transparent}
.row:last-child{border-bottom:0}
.row:active{background:var(--accent-soft)}
.row .en{color:var(--ink)}
.row .vi{font-weight:650}
.row .say{color:var(--dim); font-size:13.5px; font-style:italic; text-align:right}
@media (max-width:520px){
  .row{grid-template-columns:1fr auto; gap:2px 10px; padding:12px 13px}
  .row .en{grid-column:1; font-size:14px; color:var(--dim)}
  .row .vi{grid-column:1; font-size:18px}
  .row .say{grid-column:2; grid-row:1 / span 2; align-self:center; font-size:12.5px}
}

/* Bilingual rows (only ever built for a sheet with "bilingual": true). The
   Italian term is what the printed card says, so it leads; the price sits right;
   the reader's own language goes underneath and is clamped to two lines so a
   seven-section list stays scannable. */
.row.bi{display:block; padding:12px 14px}
.row.bi .top{display:flex; align-items:baseline; justify-content:space-between; gap:12px}
.row.bi .term{font-weight:650; font-size:17px; line-height:1.3; overflow-wrap:break-word}
.row.bi .price{flex:0 0 auto; color:var(--dim); font-size:14.5px;
  font-variant-numeric:tabular-nums; white-space:nowrap}
.row.bi .desc{color:var(--dim); font-size:14.5px; line-height:1.4; margin-top:3px;
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
  line-clamp:2; overflow:hidden}
@media (max-width:520px){
  .row.bi{padding:13px}
  .row.bi .term{font-size:16.5px}
  .row.bi .desc{font-size:14px}
}

/* ---- the card ---- */
#card{
  position:fixed; inset:0; z-index:50; display:none; flex-direction:column;
  background:#14110d; color:#f6efe2;
  padding:max(14px,env(safe-area-inset-top)) 20px max(14px,env(safe-area-inset-bottom));
}
#card.open{display:flex}
#card .bar{display:flex; justify-content:space-between; align-items:center; gap:12px;
           font-size:13px; letter-spacing:.08em; text-transform:uppercase; color:#b6a68e}
#card .bar button{background:none; border:1px solid #4a4136; color:#f6efe2; border-radius:999px;
                  padding:7px 14px; font-size:14px; letter-spacing:0; text-transform:none}
/* Top-aligned, not centred: a centred column that overflows clips BOTH ends, and
   an overflowing box can only be scrolled downward, so the first line becomes
   unreachable. flex-start plus scroll is the only pair that always reaches all of
   the text. min-height:0 is what lets this flex child shrink inside #card instead
   of pushing the nav bar off the screen. */
#card .body{flex:1; min-height:0; display:flex; flex-direction:column; justify-content:flex-start;
            align-items:flex-start; gap:14px; padding:12px 2px 16px;
            overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain}
#card .en-label{font-size:15px; color:#b6a68e; letter-spacing:.02em}
#card .vi{font-size:clamp(38px,11vw,74px); line-height:1.08; font-weight:600; letter-spacing:-.02em}
#card .say{font-size:19px; color:#d8c9ae; font-style:italic}
/* Bilingual card: Italian term (big, via .vi), pronunciation, then the plain
   meaning in the chosen language, then price and note. */
#card .term{overflow-wrap:break-word; word-break:break-word}
#card .bi-desc{font-size:19px; line-height:1.4; color:#e6dac4}
#card .bi-price{font-size:22px; font-weight:600; letter-spacing:.01em;
  font-variant-numeric:tabular-nums}
#card .speak{display:inline-flex; align-items:center; gap:8px; margin-top:4px;
  background:#2a241c; border:1px solid #4a4136; color:#f6efe2; border-radius:999px;
  padding:9px 16px; font-size:15px; letter-spacing:.01em}
#card .speak:active{background:#3a3126}
#card .speak .ico{font-size:17px; line-height:1}
#card .novoice{font-size:12.5px; color:#8a7d69; margin-top:2px}
#card .note{font-size:14px; color:#a9977c}
#card .ex{margin-top:10px; padding-top:16px; border-top:1px solid #3a3227; width:100%}
#card .ex .vi{font-size:clamp(20px,5.4vw,28px); font-weight:400; line-height:1.35}
#card .ex .tr{font-size:15px; color:#b6a68e; margin-top:8px}
#card .nav{display:flex; gap:10px; justify-content:space-between; padding-top:8px}
#card .nav button{flex:1; padding:14px; font-size:15px; border-radius:12px;
                  border:1px solid #4a4136; background:#221d17; color:#f6efe2}
#card .nav button:disabled{opacity:.3}
#hint{font-size:12px; color:#8a7d69; text-align:center; padding-top:10px}

/* A phone held sideways is ~360px tall. Sizing the word off its width (11vw of
   640px is 70px) spends the whole screen on one glyph, so the same word is
   capped by HEIGHT here and one card still fits without scrolling. */
@media (max-height:420px) and (orientation:landscape){
  #card{padding-top:max(8px,env(safe-area-inset-top));
        padding-bottom:max(8px,env(safe-area-inset-bottom))}
  #card .body{gap:9px; padding:6px 2px 12px}
  #card .vi{font-size:clamp(26px,9.5vh,42px); line-height:1.1}
  #card .say{font-size:17px}
  #card .bi-desc{font-size:16px}
  #card .bi-price{font-size:18px}
  #card .speak{padding:7px 14px; font-size:14px}
  #card .nav{padding-top:6px}
  #card .nav button{padding:10px}
  #hint{padding-top:6px}
}

@media print{
  body{background:#fff}
  #card{display:none !important}
  .secnav{display:none !important}
  .navdrawer{display:none !important}
  .row{cursor:auto}
  a{border:0;color:#000}
  .wrap{padding:0}
}
