/* Theme: dark */
/* 202° base colour + 194° harmonious */
/* Contrasts via Colorharmonygen.com */
:root {
  /* Visual Properties */
  --fg: hsla(202, 40%, 95%, 1);
  --bg: hsla(202, 80%, 15%, 1);
  --line: hsla(202, 50%, 40%, 1);
  --muted: hsla(202, 10%, 70%, 1);
  --pill-fg: hsla(194, 100%, 90%, 1);
  --pill-bg: hsla(194, 75%, 20%, 1);
  --brand: hsla(194, 95%, 70%, 1);
  --accent: hsla(322, 90%, 40%, 0.6);
  --card: hsla(322, 35%, 10%, 0.7);
}

/* Theme: light */
:root[data-theme="light"] {
  /* Visual Properties */
  --fg: hsla(202, 50%, 25%, 1);
  --bg: hsla(202, 20%, 95%, 1);
  --line: hsla(202, 30%, 70%, 1);
  --muted: hsla(202, 10%, 10%, 1);
  --pill-fg: hsla(194, 70%, 10%, 1);
  --pill-bg: hsla(194, 100%, 95%, 1);
  --brand: hsla(194, 100%, 40%, 1);
  --accent: hsla(322, 70%, 40%, 0.4);
  --card: hsla(322, 20%, 95%, 0.8);
}

/* Respect user preference by default */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    /* Visual Properties */
    color-scheme: light;
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    /* Visual Properties */
    color-scheme: dark;
  }
}

* {
  /* Box Model */
  box-sizing: border-box;
}

html,
body {
  /* Box Model */
  height: 100%;
}

body {
  /* Box Model */
  margin: 0;
  /* Typography */
  color: var(--fg);
  font-family: system-ui, sans-serif;
  line-height: 1.3;
  /* Visual */
  background: var(--bg);
}

/* --- Grouped Focus Styles --- */
a:focus-visible,
input[type=range]:focus-visible,
input[type=number]:focus-visible,
input[type=email]:focus-visible,
input[type=text]:focus-visible,
select:focus-visible,
label.inline input[type=checkbox]:focus-visible,
form#quoteForm input:focus-visible,
.toggle-label input[type=checkbox]:focus-visible,
.toggle-label input[type=number]:focus-visible,
button:focus-visible,
#menuBtn:focus-visible,
#closeDrawer:focus-visible,
.menu a:focus-visible,
.switch input[type=checkbox]:focus-visible,
.lang-btn:focus-visible {
  /* Misc */
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* --- Typography & Links --- */
h1, p.h1-page {
  /* Box Model */
  margin: 0 0 0.5rem;
  /* Typography */
  font-size: 2rem;
  font-weight: 800;
  font-variant: small-caps;
  letter-spacing: 0.3rem;
}
h2, p.h2-page {
  /* Box Model */
  margin: 0.25rem 0 0;
  /* Typography */
  font-size: 1.5rem;
  font-weight: 600;
  font-variant: small-caps;
}
header h2, header p.h2-page {
  color: var(--muted);
}
h3.h3-tight {
  /* Box Model */
  margin: 0 0 0.6rem;
}
a {
  /* Typography */
  color: var(--brand);
  text-decoration: none;
}
h1 > a, h2 > a, h3 > a, h4 > a, h5 > a, h6 > a, p.h1-page > a, p.h2-page > a {
    color: var(--fg);
}
a:hover {
  /* Typography */
  text-decoration: underline;
}
a:focus-visible {
  /* Box Model */
  border-radius: 2px;
}
.muted {
  /* Typography */
  color: var(--muted);
}
.note {
  /* Typography */
  color: var(--muted);
  font-size: .9rem;
  font-style: italic;
}

/* --- Layout & Containers --- */
.container {
  /* Box Model */
  margin: 0 auto;
  max-width: 1200px;
  padding: 1.5rem 1rem;
}
header {
  /* Box Model */
  padding-bottom: 1rem;
  /* Visual */
  background: linear-gradient(180deg, color-mix(in hsl, var(--brand) 30%, transparent 70%), transparent 70%);
}
footer {
  /* Typography */
  color: var(--muted);
  /* Visual */
  background: linear-gradient(0deg, color-mix(in hsl, var(--brand) 20%, transparent 80%), transparent 80%);
}
main {
  /* Box Model */
  border: 1px solid var(--line);
  border-color: color-mix(in hsl, var(--brand) 35%, var(--line) 65%);
  border-radius: .6rem;
  padding: 1rem;
  /* Visual */
  background: hsla(0, 0%, 0%, 0.2);
  box-shadow: 0 0 0.8rem 0.6rem var(--pill-bg), 0.6rem 0.6rem 3rem 1rem hsla(0, 0%, 0%, 0.3);
}
.row {
  /* Layout */
  display: grid;
  gap: 0.3rem;
}
.grid-2 {
  /* Box Model */
  margin-bottom: 0.5rem;
  /* Layout */
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}
.grid-3 {
  /* Layout */
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr 1fr;
}
.actions {
  /* Box Model */
  margin: .5rem 0 0;
  /* Layout */
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.actions-row {
  /* Box Model */
  margin-top: 1.5rem;
  /* Layout */
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.actions-row .btn {
  /* Layout */
  flex: 1;
  min-width: 200px;
}

/* --- Form Elements & Inputs --- */
label {
  /* Typography */
  color: var(--muted);
}
input[type=number], input[type=email], input[type=text], select {
  /* Box Model */
  border: 1px dotted var(--line);
  padding: 0.45rem 0.5rem;
  width: 100%;
  /* Typography */
  color: var(--fg);
  /* Visual */
  background: hsla(0, 0%, 0%, 0.2);
}
input[type=range] {
  /* Box Model */
  width: 100%;
}
input[type=number]:focus-visible,
input[type=email]:focus-visible,
input[type=text]:focus-visible,
select:focus-visible {
  /* Box Model */
  border-color: var(--brand);
}
select#scenario, select#license, select > option {
  /* Box Model */
  border-color: var(--line);
  /* Typography */
  color: var(--bg);
  font-weight: 700;
  /* Visual */
  background: color-mix(in hsl, var(--fg) 100%, transparent 90%);
}
form#quoteForm * input {
  /* Visual */
  background: color-mix(in hsl, var(--accent) 30%, transparent 100%);
}

/* --- Fieldsets & Accordions --- */
fieldset {
  /* Position */
  position: relative;
  /* Box Model */
  border: 1px solid var(--line);
  border-radius: .6rem;
  padding: 1rem;
}
fieldset legend {
  /* Position */
  position: relative;
  /* Box Model */
  padding-right: 1.5rem;
  /* Typography */
  color: var(--pill-fg);
  /* Visual */
  cursor: pointer;
  opacity: 0.9;
  user-select: none;
}
fieldset legend::after {
  /* Position */
  position: absolute;
  right: 0;
  /* Animation */
  content: '▼';
  transition: transform 0.3s ease;
}
fieldset.collapsed legend::after {
  /* Animation */
  transform: rotate(-90deg);
}
fieldset.collapsed > :not(legend) {
  /* Layout */
  display: none;
}
fieldset.service-accordion {
  /* Box Model */
  border-color: color-mix(in hsl, var(--brand) 35%, var(--line) 65%);
  /* Visual */
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 30%, transparent 70%), transparent 70%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

/* --- Buttons & Pills --- */
.pill {
  /* Layout */
  display: inline-block;
  /* Box Model */
  border-radius: 999px;
  margin-bottom: 1rem;
  margin-right: -0.5rem;
  padding: .2rem .6rem;
  /* Typography */
  color: var(--pill-fg);
  font-size: 0.85rem;
  /* Visual */
  background: var(--pill-bg);
}
button {
  /* Box Model */
  border: 1px solid var(--pill-bg);
  border-radius: .4rem;
  padding: .6rem 1rem;
  /* Typography */
  color: var(--pill-fg);
  font-size: 1rem;
  /* Visual */
  background: var(--pill-bg);
  cursor: pointer;
}
button:hover {
  /* Visual */
  opacity: 0.9;
}
button:disabled {
  /* Visual */
  cursor: not-allowed;
  opacity: .6;
}
button#askQuote, button[type=submit] {
  /* Visual */
  background: var(--accent);
}
.lang-btn {
  /* Box Model */
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  margin: 0.25rem;
  padding: 0.5rem 0.75rem;
  /* Typography */
  color: var(--pill-fg);
  /* Visual */
  background: var(--pill-bg);
  cursor: pointer;
}
.lang-btn:hover {
  /* Visual */
  opacity: 0.9;
}
.lang-block {
  /* Box Model */
  margin-top: .5rem;
}

/* --- Calculator & Quote Specifics --- */
.calc {
  /* Layout */
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
.out {
  /* Box Model */
  border: 1px dotted var(--line);
  border-radius: 0.6rem;
  padding: 0.5rem;
}
#scenarioNote, #licenseNote {
  /* Layout */
  display: none;
}
.totals-section {
  /* Box Model */
  border-color: var(--line);
  border-radius: 0.6rem;
  border-style: dotted solid double solid;
  border-width: 0.1rem 0.1rem 0.3rem 0.1rem;
  margin: 1rem 0;
  padding: 0.5rem;
  /* Visual */
  background: hsla(0, 0%, 0%, 0.2);
}
.total-item {
  /* Box Model */
  margin-bottom: 0.4rem;
  /* Typography */
  font-size: 1.15rem;
  font-weight: 500;
}
.total-item:last-child {
  /* Box Model */
  margin-bottom: 0;
}
#quotePanel {
  /* Box Model */
  margin-top: 1rem;
  max-height: 0;
  /* Animation */
  transition: max-height 0.3s ease;
  /* Misc */
  overflow: hidden;
}
#quotePanel.open {
  /* Box Model */
  max-height: 500px !important;
}
.form-grid {
  /* Layout */
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}
.form-actions {
  /* Box Model */
  margin-top: .75rem;
}

/* --- Form Messages & Notifications --- */
.error-message {
  /* Layout */
  display: none;
  /* Box Model */
  margin-top: 0.25rem;
  /* Typography */
  color: #ff6b6b;
  font-size: 0.85rem;
}
.error-message:not(:empty) {
  /* Layout */
  display: block;
}
.form-message {
  /* Layout */
  display: none;
  /* Box Model */
  border-radius: 0.4rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  /* Typography */
  font-size: 0.9rem;
}
.form-message:not(:empty) {
  /* Layout */
  display: block;
}
.form-message.success {
  /* Typography */
  color: #1a4620;
  /* Visual */
  background-color: #51cf66;
}
.form-message.error {
  /* Typography */
  color: #5c0a0a;
  /* Visual */
  background-color: #ff6b6b;
}
#toast {
  /* Position */
  bottom: 2rem;
  position: fixed;
  right: 2rem;
  z-index: 50;
  /* Box Model */
  border-radius: 8px;
  padding: 1rem;
  /* Typography */
  color: #fff;
  /* Visual */
  background: #333;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  /* Animation */
  transition: opacity 0.3s ease;
}
#toast:empty {
  /* Layout */
  display: none;
}
.toast {
  /* Typography */
  color: var(--pill-fg);
}

/* --- Toggles & Switches --- */
label.inline {
  /* Layout */
  align-items: center;
  display: flex;
  gap: .5rem;
}
label.inline input[type=checkbox] {
  /* Animation */
  transform: scale(1.3);
}
.toggle-label {
  /* Layout */
  align-items: center;
  display: flex;
  gap: .5rem;
}
.toggle-label input[type=checkbox] {
  /* Box Model */
  width: auto;
}
.toggle-label input[type=number] {
  /* Box Model */
  margin: 0 .25rem;
  width: 80px;
}
.switch {
  /* Layout */
  align-items: center;
  display: flex;
  gap: .5rem;
  /* Box Model */
  padding: .25rem 0;
}
.switch input[type=checkbox] {
  /* Box Model */
  height: 1.25rem;
  width: 1.25rem;
}

/* --- Hamburger Menu & Drawer --- */
button#menuBtn {
  /* Position */
  position: absolute;
  right: 1rem;
  top: 1rem;
  /* Box Model */
  border: 1px solid var(--line);
  border-radius: .4rem;
  padding: 1rem;
  /* Typography */
  color: var(--fg);
  /* Visual */
  background: transparent;
  cursor: pointer;
}
button#closeDrawer {
  /* Layout */
  display: block;
  width: 100%;
  /* Box Model */
  border: 1px solid var(--line);
  margin-bottom: 0.7rem;
  padding: 1rem;
  /* Typography */
  color: var(--fg);
  text-align: right;
  /* Visual */
  background: transparent;
}
aside.drawer {
  /* Position */
  inset: 0 0 0 auto;
  position: fixed;
  z-index: 40;
  /* Box Model */
  border-left: 1px solid var(--line);
  max-width: 60vw;
  width: 280px;
  /* Visual */
  background: var(--card);
  /* Animation */
  transform: translateX(100%);
  transition: transform .2s ease;
  /* Misc */
  overflow-y: auto;
}
.drawer.open {
  /* Animation */
  transform: translateX(0);
}
.menu {
  /* Box Model */
  padding: 0.8rem;
}
.menu a {
  /* Layout */
  display: block;
  /* Box Model */
  padding: .6rem 0;
}
.menu a:focus-visible {
  /* Typography */
  text-decoration: underline;
}
.scrim {
  /* Position */
  inset: 0;
  position: fixed;
  z-index: 30;
  /* Visual */
  backdrop-filter: saturate(120%) blur(1px);
  background: rgba(0, 0, 0, .4);
  opacity: 0;
  /* Animation */
  transition: opacity .2s ease;
  /* Misc */
  pointer-events: none;
}
.scrim.open {
  /* Visual */
  opacity: 1;
  /* Misc */
  pointer-events: auto;
}

/* --- Utility --- */
.hr-divider {
  /* Box Model */
  border: 0;
  border-bottom: 1px solid var(--line);
  margin: .5rem 0;
}

/* Focus visible polyfill support */
:focus {
  /* Misc */
  outline: none;
}
