/* ============================================================================
   Stock & Store — Trova negozio — styles.css
   Mobile-first. No external fonts, no frameworks.
   ============================================================================ */

:root {
  /* Brand colours — replace with official Stock & Store brand values */
  --color-brand-primary: #111111;
  --color-brand-primary-hover: #2b2b2b;
  --color-brand-accent: #c9a227;
  --color-bg: #ffffff;
  --color-bg-subtle: #f5f5f4;
  --color-text: #1a1a1a;
  --color-text-muted: #5b5b5b;
  --color-border: #e2e0dc;
  --color-error-bg: #fff4f2;
  --color-error-text: #7a1f10;
  --color-focus: #0b6cff;

  --radius: 12px;
  --max-width: 480px;

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--color-bg-subtle);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Visible focus styles everywhere, for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.noscript-banner {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  padding: 16px;
  text-align: center;
  font-weight: 600;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100vh;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.logo {
  display: block;
  width: min(280px, 78vw);
  height: auto;
}

.title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--color-text);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin: 0;
}

.locator {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 20px;
}

.state {
  text-align: center;
}

.state-text {
  font-size: 1rem;
  margin: 0 0 8px;
}

.state-help {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0 0 16px;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-brand-primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.05s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-brand-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--color-brand-primary-hover);
}

.btn-primary:disabled {
  background: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-large {
  min-height: 56px;
  font-size: 1.1rem;
  margin: 20px 0 16px;
}

/* Result card */
.result-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 16px;
  text-align: center;
}

.store-card {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.store-image-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: calc(var(--radius) - 4px);
  background: var(--color-border);
}

.store-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.store-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.store-address,
.store-city {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin: 0 0 4px;
}

.store-distance {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-brand-primary);
  margin: 10px 0 0;
}

.store-phone-wrap {
  margin: 10px 0 0;
}

.store-phone {
  color: var(--color-focus);
  font-weight: 600;
  text-decoration: underline;
}

.privacy-note {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
  margin: 0;
}

/* Permission / error states */
.state-permission .btn,
.state-empty .btn {
  margin-top: 8px;
}

/* Small screens safety (very narrow devices) */
@media (max-width: 340px) {
  .page {
    padding: 16px 14px 32px;
  }
}
