/*!
 * Parafarmacia Fiori — pagina di cortesia
 * Design & sviluppo: Altoprofilo · https://www.altoprofilo.studio
 */

@layer reset, tokens, base, layout, components, motion;

/* Inter variabile con asse ottico, ospitata: nessuna richiesta a terzi */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-ext-opsz-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-opsz-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, p, dl, dd, figure { margin: 0; }
  img, svg, picture { display: block; max-inline-size: 100%; }
  address { font-style: normal; }
}

@layer tokens {
  :root {
    color-scheme: light;

    /* colore */
    --c-white: #fff;
    --c-page: #fbf8f3;
    --c-paper: #ddeff4;
    --c-ink: #34444f;
    --c-ink-deep: #10233a;
    --c-ink-muted: rgb(16 35 58 / 0.6);
    --c-accent: #1090b0;
    --c-accent-deep: #0b6e8a;
    --c-line: rgb(16 35 58 / 0.12);
    --c-open: #2e9e6b;
    --c-closed: #c8453b;

    /* tipografia */
    --f-sans: "Inter Variable", "Helvetica Neue", Arial, sans-serif;
    --t-body: 17px;
    --t-lead: clamp(17px, 1.4vw, 19px);
    --t-h1: clamp(30px, 3.6vw, 42px);
    --t-label: 13px;
    --t-small: 14px;

    /* spazio, forma, ombra */
    --gutter: clamp(20px, 4vw, 64px);
    --measure: 1200px;
    --radius: 20px;
    --control: 54px;
    --shadow-card: 0 1px 2px rgb(16 35 58 / 0.05), 0 24px 48px -24px rgb(16 35 58 / 0.22);
    --shadow-cta: 0 1px 2px rgb(11 110 138 / 0.2), 0 12px 28px -12px rgb(11 110 138 / 0.6);
    --shadow-cta-hover: 0 1px 2px rgb(16 35 58 / 0.2), 0 14px 30px -12px rgb(16 35 58 / 0.55);

    /* movimento */
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --ease-draw: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 200ms;
  }
}

@layer base {
  body {
    display: flex;
    flex-direction: column;
    min-block-size: 100dvh;
    background: var(--c-page);
    color: var(--c-ink);
    font: 400 var(--t-body) / 1.5 var(--f-sans);
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
  }

  a {
    color: var(--c-accent-deep);
    text-underline-offset: 3px;
  }

  :focus-visible {
    outline: 2px solid var(--c-accent-deep);
    outline-offset: 2px;
    border-radius: 4px;
    box-shadow: 0 0 0 4px var(--c-page);
  }

  .nowrap { white-space: nowrap; }
}

@layer layout {
  .wrap {
    inline-size: 100%;
    max-inline-size: var(--measure);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .page {
    flex: 1;
    display: grid;
    gap: 28px;
    align-content: start;
    padding-block: 8px 40px;
  }

  @media (min-width: 900px) {
    .page {
      grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
      gap: 56px;
      align-content: center;
      padding-block-end: 44px;
    }
  }
}

@layer components {
  /* ── marchio ───────────────────────────────────────────── */
  .masthead {
    display: flex;
    align-items: center;
    min-block-size: 80px;
    margin-block-end: 12px;
  }
  .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
  }
  .brand__mark { block-size: 40px; inline-size: auto; }
  .brand__name {
    display: flex;
    flex-direction: column;
    line-height: 1;
    white-space: nowrap;
  }
  .brand__name b {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--c-ink-deep);
  }
  .brand__name small {
    margin-block-start: 5px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--c-accent-deep);
  }
  @media (min-width: 900px) {
    .masthead { min-block-size: 104px; margin-block-end: 0; }
    .brand { gap: 12px; }
    .brand__mark { block-size: 56px; }
    .brand__name b { font-size: 32px; }
    .brand__name small { margin-block-start: 6px; font-size: 12px; }
  }

  /* ── apertura ──────────────────────────────────────────── */
  .eyebrow {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-block-end: 18px;
    font-size: var(--t-label);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-accent-deep);
  }
  .eyebrow::before {
    content: "";
    flex: none;
    inline-size: 40px;
    block-size: 1.5px;
    background: currentColor;
    transform-origin: left center;
  }

  .title {
    font-size: var(--t-h1);
    font-weight: 500;
    line-height: 1.12;
    letter-spacing: -0.022em;
    color: var(--c-ink-deep);
    text-wrap: balance;
  }
  .title em { font-style: normal; color: var(--c-accent-deep); }

  .lead {
    max-inline-size: 46ch;
    margin-block-start: 18px;
    font-size: var(--t-lead);
    line-height: 1.45;
    text-wrap: pretty;
  }

  .lead--note { margin-block-start: 10px; }
  .lead strong { font-weight: 500; color: var(--c-ink-deep); }

  /* ── azioni ────────────────────────────────────────────── */
  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-block-start: 24px;
  }
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-block-size: var(--control);
    padding-inline: 26px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out;
  }
  .btn svg { inline-size: 18px; block-size: 18px; }
  .btn__arrow { transition: transform var(--dur-fast) ease-out; }
  .btn:hover .btn__arrow { transform: translate(2px, -2px); }

  .btn--primary {
    background: var(--c-accent-deep);
    color: var(--c-white);
    box-shadow: var(--shadow-cta);
  }
  .btn--primary:hover { background: var(--c-ink-deep); box-shadow: var(--shadow-cta-hover); }

  .btn--secondary {
    background: var(--c-white);
    color: var(--c-accent-deep);
    box-shadow: inset 0 0 0 1px rgb(11 110 138 / 0.35), 0 1px 2px rgb(16 35 58 / 0.05);
  }
  .btn--secondary:hover { box-shadow: inset 0 0 0 1px var(--c-accent-deep), 0 1px 2px rgb(16 35 58 / 0.05); }

  @media (max-width: 520px) {
    .btn { flex: 1 1 100%; }
  }

  /* ── recapiti ──────────────────────────────────────────── */
  .facts {
    margin-block-start: 28px;
    border-block-start: 1px solid var(--c-line);
  }
  .facts__row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 16px;
    padding-block: 10px;
    border-block-end: 1px solid var(--c-line);
  }
  @media (min-width: 521px) {
    .facts__row { grid-template-columns: 104px minmax(0, 1fr); }
  }
  .facts dt {
    padding-block-start: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--c-ink-muted);
  }
  .facts dd {
    color: var(--c-ink-deep);
    overflow-wrap: break-word;
  }
  .facts dd a {
    display: inline-block;
    padding-block: 4px;
    color: inherit;
    text-decoration-color: rgb(16 35 58 / 0.3);
  }
  .facts dd a:hover { color: var(--c-accent-deep); text-decoration-color: currentColor; }

  @media (max-width: 520px) {
    .facts .facts__list a { display: block; inline-size: fit-content; }
    .facts .facts__list .sep { display: none; }
  }

  /* stato in tempo reale, popolato da /assets/orari.js */
  .status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-block-start: 6px;
    font-size: var(--t-small);
    color: var(--c-ink);
  }
  .status[hidden] { display: none; }
  .status::before {
    content: "";
    inline-size: 8px;
    block-size: 8px;
    border-radius: 50%;
    background: var(--c-closed);
    box-shadow: 0 0 0 4px rgb(200 69 59 / 0.14);
  }
  .status[data-state="open"]::before {
    background: var(--c-open);
    box-shadow: 0 0 0 4px rgb(46 158 107 / 0.16);
  }
  .status strong { font-weight: 500; color: var(--c-ink-deep); }

  /* ── mappa ─────────────────────────────────────────────── */
  .map {
    position: relative;
    order: 2;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    isolation: isolate;
    border-radius: var(--radius);
    background: var(--c-paper);
    box-shadow: var(--shadow-card);
  }
  .map::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgb(16 35 58 / 0.08);
    pointer-events: none;
  }
  @media (min-width: 900px) {
    .map { aspect-ratio: auto; min-block-size: 420px; }
  }
  .map__link, .map picture { display: block; block-size: 100%; }
  .map img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    transition: transform 900ms var(--ease-out);
  }
  .map:hover img { transform: scale(1.04); }

  .map__pin {
    position: absolute;
    inset: 50% auto auto 50%;
    inline-size: 34px;
    block-size: 44px;
    color: var(--c-accent-deep);
    transform: translate(-50%, -100%);
    filter: drop-shadow(0 4px 8px rgb(16 35 58 / 0.25));
  }
  .map__halo {
    position: absolute;
    inset: 50% auto auto 50%;
    inline-size: 18px;
    block-size: 8px;
    margin: -4px 0 0 -9px;
    border-radius: 50%;
    background: rgb(11 110 138 / 0.35);
  }
  .map__credit {
    position: absolute;
    inset: auto 10px 8px auto;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.85);
    font-size: 11px;
    color: var(--c-ink);
  }
  .map__credit a { color: inherit; }

  /* ── piede ─────────────────────────────────────────────── */
  .colophon {
    background: var(--c-ink-deep);
    color: rgb(255 255 255 / 0.78);
    font-size: 13px;
    line-height: 1.6;
  }
  .colophon .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 32px;
    padding-block: 22px;
  }
  .colophon :focus-visible { outline-color: var(--c-white); box-shadow: 0 0 0 4px var(--c-ink-deep); }

  .credit {
    display: inline-flex;
    align-items: center;
    margin: -12px 0 -12px auto;
    padding-block: 12px;
    color: var(--c-white);
    opacity: 0.75;
    transition: opacity var(--dur-fast) ease-out;
  }
  .credit:hover, .credit:focus-visible { opacity: 1; }
  .credit__mark {
    display: block;
    block-size: 15px;
    aspect-ratio: 5122 / 1219.8;
    background: currentColor;
    mask: url("/altoprofilo-wordmark.svg") center / contain no-repeat;
  }
  @media (min-width: 900px) {
    .credit__mark { block-size: 16px; }
  }
  @media (max-width: 699px) {
    .credit { margin-inline-start: 0; flex-basis: 100%; }
  }
  @media (forced-colors: active) {
    .credit__mark { background: CanvasText; }
  }
}

@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    /* ingresso: le righe salgono in sequenza, il filo dell'etichetta si disegna.
       La mappa resta ferma: è l'elemento LCP su desktop */
    .intro > * { animation: rise 800ms var(--ease-out) both; }
    .intro > :nth-child(2) { animation-delay: 70ms; }
    .intro > :nth-child(3) { animation-delay: 140ms; }
    .intro > :nth-child(4) { animation-delay: 210ms; }
    .intro > :nth-child(5) { animation-delay: 280ms; }
    .intro > :nth-child(6) { animation-delay: 350ms; }
    .eyebrow::before { animation: draw 1200ms 200ms var(--ease-draw) both; }

    .map__halo { animation: halo 2.8s 1.2s ease-out infinite; }
  }

  @media (prefers-reduced-motion: reduce) {
    .map img { transition: none; }
    .map:hover img { transform: none; }
  }

  @keyframes rise { from { opacity: 0; transform: translateY(14px); } }
  @keyframes draw { from { transform: scaleX(0); } }
  @keyframes halo {
    from { opacity: 0.9; transform: scale(1); }
    to { opacity: 0; transform: scale(4.5); }
  }
}
