/* css/app.css */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--space-3); }
a { color: var(--primary); }

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-6);
}

.app-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.app-header img { height: 56px; }
.intro { color: var(--text-muted); margin-bottom: var(--space-5); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

label { display: block; font-size: .82rem; color: var(--text-muted); margin-bottom: var(--space-1); }
input, select, button { font: inherit; }
.field { margin-bottom: var(--space-3); }
.input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.input.invalid { border-color: var(--danger); }
.error { color: var(--danger); font-size: .78rem; margin-top: var(--space-1); min-height: 1em; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

/* Segmented mode toggle */
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.segmented button {
  border: 0; background: transparent; color: var(--text-muted);
  padding: var(--space-2) var(--space-4); border-radius: 999px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); }

/* Searchable camera picker */
.picker { position: relative; }
.picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  margin: 0; padding: var(--space-1); list-style: none;
}
.picker-list[hidden] { display: none; }
.picker-group { font-size: .72rem; text-transform: uppercase; color: var(--text-muted); padding: var(--space-2) var(--space-2) var(--space-1); }
.picker-option { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); cursor: pointer; }
.picker-option[aria-selected="true"], .picker-option:hover { background: var(--surface-2); }

/* Result cards */
.results { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.metric { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--space-3); }
.metric .label { font-size: .72rem; text-transform: uppercase; color: var(--text-muted); }
.metric .value { font-size: 1.25rem; font-weight: 600; }
.metric .unit { font-size: .8rem; color: var(--text-muted); margin-left: 4px; }
.results[hidden] { display: none; }
.results-hint { color: var(--text-muted); }

.btn-primary {
  width: 100%; padding: var(--space-3); border: 0; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--primary-text); cursor: pointer;
}
.theme-toggle { background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: var(--space-2) var(--space-3); color: var(--text); cursor: pointer; }

#share-buttons { display: flex; gap: var(--space-2); flex-wrap: wrap; margin: var(--space-3) 0; }
#share-buttons > div { width: 32px; height: 32px; cursor: pointer; fill: var(--text-muted); }
#share-buttons > div:hover { fill: var(--primary); }
#share-buttons svg { width: 100%; height: 100%; }

footer { color: var(--text-muted); font-size: .85rem; text-align: center; margin-top: var(--space-5); }

.center { text-align: center; }
.muted { color: var(--text-muted); }

@media (max-width: 420px) {
  .grid-2, .results { grid-template-columns: 1fr; }
}
