/* Colours from the header image: the petrol blue of the NYGATAN lettering,
   the pale sky behind the house, the warm white of its wooden facade, the
   black ring of the 9. */
:root {
  --petrol: #0077a1;
  --petrol-deep: #005f81;
  --sky: #dee4fc;
  --facade: #f7f3ec;
  --card: #ffffff;
  --ink: #14232b;
  --muted: #5d6a71;
  --rule: #e2dbd0;
  --ring: #1a1a1a;
  --bg: var(--facade);
  --fg: var(--ink);
  --accent: var(--petrol);
  --accent-fg: #ffffff;
  --link: var(--petrol-deep);
  --heading: var(--petrol);
  --shadow: 0 1px 2px rgba(20, 35, 43, 0.06), 0 4px 16px rgba(20, 35, 43, 0.06);
  --condensed: "Bahnschrift SemiCondensed", Bahnschrift, "Avenir Next Condensed",
    "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1b21;
    --fg: #e4ecf0;
    --card: #162630;
    --muted: #9fb0b8;
    --rule: #26404d;
    --ring: #e4ecf0;
    --accent: #3fa9d4;
    --accent-fg: #06141b;
    --link: #6cc3e6;
    --heading: #6cc3e6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
a:hover { text-decoration-thickness: 0.14em; }
strong { font-weight: 650; }

main { max-width: 42rem; margin: 0 auto; padding: 2.5rem 1rem 3.5rem; }

/* Headings take the logo's condensed face, not its capitals: they read as
   written ("Hyra Nygatan9"), only the logo itself shouts. */
h1, h2, .site-nav a, th {
  font-family: var(--condensed);
  font-stretch: condensed;
  letter-spacing: 0.01em;
}
h1 {
  color: var(--heading);
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.05;
  font-weight: 700;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}
/* The paragraph under the title reads as an intro. */
main > h1 + p { font-size: 1.12rem; }
/* A short black stroke under the title, like the tail of the 9. */
h1::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 0.3rem;
  margin-top: 0.6rem;
  border-radius: 0.15rem;
  background: var(--ring);
}
h2 {
  color: var(--heading);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2.25rem 0 0.6rem;
  text-wrap: balance;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
/* The ring of the 9 marks each section. */
h2::before {
  content: "";
  flex: none;
  width: 0.75em;
  height: 0.75em;
  border: 0.16em solid var(--ring);
  border-radius: 50%;
}
p { margin: 0 0 1rem; }
ul { padding-left: 1.2rem; margin: 0 0 1rem; }
li { margin: 0.3rem 0; }
li::marker { color: var(--accent); }
.lead { color: var(--muted); margin: 0 0 1.5rem; }
section + section { border-top: 2px solid var(--rule); margin-top: 2.5rem; padding-top: 0.5rem; }

/* Price table. */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1.25rem;
  background: var(--card);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}
th {
  background: var(--petrol);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
  padding: 0.6rem 0.9rem;
}
td { padding: 0.75rem 0.9rem; border-top: 1px solid var(--rule); }
td:last-child { white-space: nowrap; font-weight: 700; font-size: 1.1rem; text-align: right; }
th:last-child { text-align: right; }

/* Site pages: the banner sits in a full-width band of its own sky, with
   the menu on a petrol bar below. The banner photo is light, so the band
   stays light in dark mode too. */
.site-header { background: var(--sky); }
.site-header img { display: block; width: 100%; max-width: 940px; height: auto; margin: 0 auto; }
/* On wide screens the photo's edges fade into the band instead of ending in
   a seam. */
@media (min-width: 941px) {
  .site-header img {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 1%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 1%, #000 88%, transparent);
  }
}
.site-nav { background: var(--petrol); }
.site-nav-inner {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
}
.site-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0.7rem 0.6rem 0.6rem;
  border-bottom: 0.25rem solid transparent;
}
.site-nav a:hover { background: var(--petrol-deep); }
.site-nav a[aria-current="page"] { border-bottom-color: #fff; }
/* Phones: the five entries share one line. */
@media (max-width: 480px) {
  .site-nav-inner { justify-content: space-between; padding: 0 0.25rem; }
  .site-nav a { font-size: 0.92rem; padding: 0.65rem 0.35rem 0.55rem; letter-spacing: 0.01em; }
}

.site-footer { background: #14232b; color: #c5d3da; border-top: 0.3rem solid var(--petrol); }
.site-footer p {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  font-size: 0.9rem;
}
.site-footer strong { color: #fff; font-family: var(--condensed); letter-spacing: 0.05em; }

/* Click-to-load map (build.sh, "@karta"). */
.karta { margin: 1.5rem 0; }
.karta-frame {
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--sky);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.karta-frame iframe { width: 100%; height: 100%; border: 0; }
.karta-load {
  font: inherit;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  border: 0;
  border-radius: 0.4rem;
  background: var(--petrol);
  color: #fff;
  cursor: pointer;
}
.karta-load:hover { background: var(--petrol-deep); }
.karta-note { margin: 0; font-size: 0.85rem; color: #3d4b52; }
.karta figcaption { font-size: 0.9rem; margin-top: 0.5rem; }

.fine { color: var(--muted); font-size: 0.9rem; }

/* The rental contract (/hyra/avtal/): a form on screen, a document on paper.
   Sections are numbered here only, so the same headings read plain on /hyra/. */
.avtal { counter-reset: avsnitt; }
.avtal h2 { counter-increment: avsnitt; }
.avtal h2::before {
  content: counter(avsnitt) ".";
  width: auto; height: auto; border: 0; border-radius: 0;
}
.avtal h2.onumrerad { counter-increment: none; }
.avtal h2.onumrerad::before { content: none; }
.avtal-huvud img { display: none; }
.avtal-huvud h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
.avtal-verktyg {
  background: var(--card); box-shadow: var(--shadow); border-radius: 0.5rem;
  padding: 0.25rem 1rem 0.75rem; margin-bottom: 2rem;
}
.utkast h2 { margin-top: 1rem; }
#utkast-lista { list-style: none; padding: 0; }
#utkast-lista li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem;
  padding: 0.4rem 0; border-top: 1px solid var(--rule);
}
#utkast-lista li span:first-child { flex: 1 1 12rem; font-weight: 600; }
#utkast-lista li.aktuellt span:first-child::after { content: " (öppet)"; color: var(--muted); font-weight: 400; }
.gammalt { color: #a33b00; font-size: 0.85rem; flex-basis: 100%; order: 3; }
.avtal button {
  font: inherit; font-weight: 600; padding: 0.4rem 0.9rem; border-radius: 0.35rem;
  border: 2px solid var(--petrol); background: transparent; color: var(--link); cursor: pointer;
}
.avtal-knappar button:last-child { background: var(--petrol); color: #fff; }
.avtal-knappar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.avtal fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.avtal legend { font-weight: 700; margin-bottom: 0.4rem; }
.parter { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem 2rem; }
.parter dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; margin: 0; }
.parter dt { color: var(--muted); font-size: 0.85rem; padding-top: 0.15rem; }
.parter dd { margin: 0; }
.falt { display: block; margin: 0 0 0.6rem; color: var(--muted); font-size: 0.85rem; }
.falt input { display: block; width: 100%; margin-top: 0.15rem; }
.rad { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.rad .falt { flex: 1 1 11rem; }
.rad .falt.kort { flex: 0 1 7rem; }
.kryss { display: flex; align-items: center; gap: 0.5rem; margin: 0.35rem 0; }
.kryss input[type="checkbox"], .kryss input[type="radio"] { width: 1.1rem; height: 1.1rem; accent-color: var(--petrol); }
.kryss input:not([type="checkbox"]):not([type="radio"]) { flex: 1 1 auto; max-width: 16rem; }
.kryss input.smal { flex: 0 0 5rem; }
.avtal input:not([type="checkbox"]):not([type="radio"]) {
  font: inherit; color: var(--fg); font-size: 1rem;
  padding: 0.4rem 0.5rem; border: 1px solid var(--rule); border-radius: 0.3rem; background: var(--card);
}
.avtal input:focus { outline: 2px solid var(--petrol); outline-offset: 1px; }
.deposition-val { margin: 0.5rem 0 1rem; }
.faktura-markning { margin: 0.25rem 0 0.75rem 1.6rem; max-width: 20rem; }
.avtal .dold { display: none; }
.underskrifter { margin-top: 2.5rem; }
.part { font-weight: 700; margin: 0 0 2.5rem; }
.signatur { border-top: 1px solid var(--fg); padding-top: 0.2rem; color: var(--muted); font-size: 0.85rem; }

/* On paper: only the contract, A4, values as text and blanks as lines. */
@page { size: A4; margin: 16mm 16mm 18mm; }
@media print {
  :root { --fg: #000; --muted: #444; --heading: #005f81; --ring: #000; --rule: #999; }
  body { background: #fff; color: #000; font-size: 10pt; line-height: 1.4; }
  .site-header, .site-nav, .site-footer, .avtal-verktyg, .avtal-skarm { display: none; }
  main { max-width: none; padding: 0; }
  .avtal-huvud img { display: block; width: 55mm; height: auto; margin-bottom: 4mm; }
  .avtal-huvud h1 { font-size: 18pt; }
  .avtal-huvud h1::after { display: none; }
  .avtal h2 { font-size: 11pt; margin: 5mm 0 1.5mm; break-after: avoid; }
  .avtal p, .avtal li { margin: 0 0 1.5mm; }
  table { box-shadow: none; border: 1px solid #999; }
  th { background: #eee; color: #000; }
  .avtal input:not([type="checkbox"]):not([type="radio"]) {
    border: 0; border-radius: 0; background: none; padding: 0 0 1px; color: #000; font-size: 10pt;
  }
  .avtal input.tom:not([type="checkbox"]):not([type="radio"]), .utskrift.tom {
    border-bottom: 1.25pt solid #000; min-height: 6mm; min-width: 35mm;
  }
  .avtal input:not([type="checkbox"]):not([type="radio"]) { field-sizing: content; }
  .kryss input:not([type="checkbox"]):not([type="radio"]) { flex: 0 0 auto; }
  .avtal input[type="date"], .avtal input[type="time"] { display: none; }
  .utskrift { display: block; min-height: 5mm; }
  .avtal input::-webkit-calendar-picker-indicator { display: none; }
  .avtal input.tom::-webkit-datetime-edit { color: transparent; }
  .avtal input.tom::placeholder { color: transparent; }
  .falt { font-size: 8pt; margin-bottom: 2mm; }
  .tom-rad { display: none; }
  .underskrifter { break-inside: avoid; margin-top: 6mm; }
  .part { margin-bottom: 14mm; }
}
/* The print-only text twin of each date/time field (avtal.html refresh()). */
@media screen { .utskrift { display: none; } }
