﻿/* style.css */
/* ========== 1) Reset & variables ========== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-page);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.modal-open {
  overflow: hidden;
}

:root{
  --bg-page: #CDEDEF;
  --bg-card: #FFFFFF;
  --text: #0f172a;             /* slate-900 */
  --text-muted: #475569;       /* slate-600 */
  --muted-2: #94a3b8;          /* slate-400 */
  --chip-bg: #ffffff;
  --chip-active: #d8f3f3;
  --chip-border: #d0dbe7;
  --primary: #000000;
  --link: #0f172a;
  --shadow-1: 0 1px 1px rgba(2,6,23,.06), 0 8px 24px rgba(2,6,23,.06);
  --shadow-2: 0 1px 1px rgba(2,6,23,.06), 0 18px 40px rgba(2,6,23,.10);
  --radius: 16px;
  --radius-sm: 10px;
  --container: 1200px;
  --z-floating: 900;
  --z-modal: 1300;
}

/* Utilities */
.container{ max-width: var(--container); margin-inline:auto; padding-inline: clamp(16px, 4vw, 32px); }
.sr-only{ position:absolute!important; width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
a{ color: var(--link); text-decoration: none; }
a:hover{ text-decoration: underline; }
.skip-link{
  position: absolute; top: -40px; left: 12px; background:#111; color:#fff; padding:8px 12px; border-radius:8px;
}
.skip-link:focus{ top:12px; outline: none; }

/* Focus style */
:where(a, button, [role="tab"]) :focus{ outline: none; }
:where(a, button, [role="tab"], .chip, .card-link, .card-send):focus-visible{
  outline: 2px solid #0ea5e9; outline-offset: 2px; border-radius: 10px;
}

/* Header styles removed - no longer needed */

/* ========== 3) Main layout ========== */
.site-main{ padding-top: 8px; }

/* Hero */
.hero{ padding: clamp(32px, 8vw, 80px) 0 12px; position:relative; }
.hero-inner{ display:grid; grid-template-columns: 1fr; align-items:center; gap: 24px; }
.hero-title{ font-size: clamp(1.85rem, 2.8vw + 1rem, 3rem); line-height: 1.1; margin:0 0 8px; }
.hero-subtitle{ margin:0; max-width: 60ch; color: var(--text-muted); font-size: clamp(1rem, 1.1vw + .8rem, 1.125rem); }
.hero-art{ position:relative; height:0; }
.art{ display:none; }

@media (min-width: 900px){
  .hero-inner{ grid-template-columns: 1fr 1fr; }
  .hero-art{ height:160px; }
  .art{ display:block; position:absolute; top:-24px; width:220px; height:160px; border-radius: 20px; opacity:.18; }
  .art-left{ left:-8px; background: linear-gradient(135deg,#89e3e3,#fff); }
  .art-right{ right:0; background: linear-gradient(135deg,#e7f7f6,#9edcdc); }
}

/* ========== 4) Chips (filters) ========== */
.filters{ position: sticky; top: 6px; z-index: 50; margin-bottom: 16px; }
.filters-inner{
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  padding-block: 8px 12px;
}
.chips{
  display:flex; gap:10px; padding:8px; background: #fff8; backdrop-filter: blur(6px);
  border:1px solid rgba(2,6,23,.06); border-radius: 9999px; width:max-content; margin-inline:auto;
  box-shadow: var(--shadow-1);
}
.chip{
  appearance:none; border:1px solid var(--chip-border); background: var(--chip-bg); color: var(--text);
  border-radius:9999px; padding:8px 16px; font-weight:600; cursor:pointer; transition: background .2s ease, border-color .2s ease;
}
.chip:hover{ background: #f3fafb; }
.chip.is-active, .chip[aria-selected="true"]{ background: var(--chip-active); border-color: #a8e0df; }

/* Floating chips (mobile) */
.chips-floating{
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(10px, calc(10px + env(safe-area-inset-bottom)));
  z-index: var(--z-floating);
  display: none; gap: 10px; padding: 8px; background: rgba(255,255,255,.85);
  border: 1px solid rgba(2,6,23,.08); border-radius: 9999px; box-shadow: var(--shadow-2);
  backdrop-filter: blur(10px);
}
@media (max-width: 700px){
  .filters-inner{ align-items: stretch; }
  .filters .chips{ display:none; }
  .chips-floating{ display:flex; }
}

.scroll-top{
  position: fixed;
  right: clamp(16px, 4vw, 32px);
  bottom: max(16px, calc(16px + env(safe-area-inset-bottom, 0px)));
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, .12);
  background: var(--bg-card);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, box-shadow .25s ease, background .25s ease;
  z-index: calc(var(--z-floating) + 5);
}

.scroll-top svg{
  display: block;
}

.scroll-top:hover,
.scroll-top:focus-visible{
  box-shadow: var(--shadow-2);
  background: #f8fbfb;
}

.scroll-top.is-visible{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 480px){
  .scroll-top{
    width: 44px;
    height: 44px;
  }
}

/* ========== 5) Cards grid ========== */
.cards-section{ padding: 20px 0 80px; }
.results-count{ color: var(--text-muted); margin: 0 0 10px; text-align: center; }
.search-container{
  margin: 0;
  max-width: 520px;
  width: min(100%, 520px);
  margin-inline: auto;
}
.search-wrapper{
  position: relative;
  display: flex;
  align-items: center;
}
.search-label{
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.search-input{
  width: 100%;
  padding: 12px 44px;
  border: 1px solid var(--chip-border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.search-input::placeholder{
  color: var(--muted-2);
}
.search-input:focus-visible{
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14,165,233,.2);
}
.search-container.is-active .search-input{
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}
.search-container.is-active .search-icon{
  color: #0ea5e9;
}
.search-icon{
  position: absolute;
  left: 16px;
  color: var(--muted-2);
  display: inline-flex;
  pointer-events: none;
}
.search-clear{
  position: absolute;
  right: 8px;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--muted-2);
  border-radius: 6px;
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}
.search-clear:hover,
.search-clear:focus-visible{
  color: var(--text);
  background: rgba(15,23,42,.06);
}
.search-help:not(.sr-only){
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: .9rem;
  text-align: center;
}
.cards-grid{
  display:grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.no-results{
  width: 100%;
  padding: 36px clamp(16px, 5vw, 40px);
  text-align: center;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: var(--shadow-1);
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.no-results-icon{
  font-size: 2rem;
  margin: 0 0 12px;
}
.no-results-title{
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: var(--text);
}
.no-results-message{
  margin: 0;
  margin-inline: auto;
  max-width: 48ch;
}
.no-results .btn{
  margin-top: 16px;
}

@media (max-width: 600px){
  .search-container{
    margin: 20px 0 24px;
  }
  .search-input{
    padding: 12px 40px;
    font-size: 1rem;
  }
  .search-icon{
    left: 14px;
  }
  .no-results{
    padding: 28px 16px;
  }
}
@media (min-width: 640px){
  .cards-grid{ gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}
@media (min-width: 1024px){
  .cards-grid{ gap: 20px; }
}

/* Card */
.card{
  position: relative; background: var(--bg-card); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow-1); border: 1px solid rgba(15, 23, 42, .06);
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
.card:hover{ box-shadow: var(--shadow-2); transform: translateY(-1px); }
.card-link{ display:block; color: inherit; text-decoration: none; }
.card-title{ margin:0 0 8px; font-size: 1.05rem; line-height: 1.25; }
.card-desc{ margin:0; color: var(--text-muted); }
.attachments{
  list-style:none; margin: 12px 0 0; padding:0; display:flex; flex-wrap:wrap; gap:8px;
}
.file-pill{
  display:inline-flex; align-items:center; gap:6px; padding:4px 10px;
  background: #fff; border: 1px dashed #cbd5e1; color: var(--text-muted);
  border-radius: 10px; font-size: .85rem;
}
.file-icon{ font-size: 1rem; }

/* Quick action button (hover) */
.card-send{
  position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 9999px;
  display: grid; place-items:center; border:1px solid rgba(15,23,42,.12);
  background:#0f172a; color:#fff; box-shadow: 0 6px 16px rgba(2,6,23,.16);
  opacity: 0; transform: translateY(4px); transition: opacity .2s ease, transform .2s ease, filter .2s ease;
  cursor: pointer;
}
.card:hover .card-send, .card:focus-within .card-send{ opacity: 1; transform: translateY(0); }
.card-send:hover{ filter: brightness(1.05); }

/* No-JS fallback */
.nojs{
  padding: 14px 16px; border:1px solid rgba(15,23,42,.12); border-radius: var(--radius-sm);
  background:#fff; color: var(--text-muted);
}

/* ========== 6) Footer ========== */
.site-footer{
  padding: 32px 0 64px; border-top: 1px solid rgba(15,23,42,.08);
  background: color-mix(in oklab, var(--bg-page) 92%, white);
}
.footer-inner{ text-align: center; color: var(--text-muted); }
.link-underline{ text-decoration: underline; }

/* ========== 7) Modal ========== */
.modal-overlay{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .72);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  padding: clamp(16px, 4vw, 32px);
}

.modal-overlay.is-open{
  opacity: 1;
  visibility: visible;
}

.modal-container{
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  width: min(600px, 92vw);
  max-height: min(640px, 90vh);
  display: flex;
  flex-direction: column;
  transform: translateY(24px);
  transition: transform .3s ease;
}

.modal-overlay.is-open .modal-container{
  transform: translateY(0);
}

.modal-header,
.modal-footer{
  padding: 20px clamp(20px, 5vw, 28px);
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-header{
  justify-content: space-between;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.modal-title{
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--text);
}

.modal-close{
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.modal-close:hover,
.modal-close:focus-visible{
  background: rgba(226, 232, 240, .6);
  color: var(--text);
}

.modal-body{
  padding: 0 clamp(20px, 5vw, 28px) 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-description{
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.modal-instructions{
  margin: 4px 0 0;
  color: var(--muted-2);
  font-size: .9rem;
}

.placeholder-form{
  display: grid;
  gap: 16px;
}

.placeholder-field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.placeholder-label{
  font-weight: 600;
  color: var(--text);
}

.placeholder-required{
  color: #e11d48;
  font-size: .95em;
}

.placeholder-input,
.placeholder-textarea,
.prompt-textarea{
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, .7);
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.placeholder-input:focus-visible,
.placeholder-textarea:focus-visible,
.prompt-textarea:focus-visible{
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, .2);
  outline: none;
}

.placeholder-hint{
  margin: 0;
  font-size: .875rem;
  color: var(--muted-2);
}

.prompt-preview{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-preview-label{
  font-weight: 600;
  color: var(--text);
}

.prompt-textarea{
  min-height: 180px;
  resize: vertical;
}

.modal-footer{
  justify-content: flex-end;
  border-top: 1px solid rgba(15, 23, 42, .08);
  gap: 12px;
}

.btn{
  appearance: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.btn-primary{
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.btn-primary:hover,
.btn-primary:focus-visible{
  background: #111f37;
  border-color: #111f37;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .22);
}

.btn-secondary{
  background: #fff;
  color: var(--text);
  border-color: rgba(15, 23, 42, .18);
}

.btn-secondary:hover,
.btn-secondary:focus-visible{
  background: rgba(226, 232, 240, .5);
}

@media (max-width: 640px){
  .modal-container{
    width: min(520px, 96vw);
    max-height: 92vh;
    border-radius: calc(var(--radius) - 6px);
    margin-inline: auto;
  }

  .modal-header,
  .modal-body,
  .modal-footer{
    padding-inline: clamp(16px, 6vw, 24px);
  }
}

@media (max-width: 480px){
  .modal-container{
    width: 100%;
    max-height: none;
    height: calc(100vh - 40px);
  }

  @supports (height: 100dvh) {
    .modal-container{
      height: calc(100dvh - 40px);
    }
  }

  .modal-overlay{
    align-items: flex-start;
  }

  .modal-footer{
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

/* ========== 7) Helpers ========== */
[aria-busy="true"]{ opacity: .7; }

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce){
  .card, .card-send{ transition: none; }
  .chips, .btn, .modal-overlay, .modal-container { transition: none; }
  .search-input, .search-clear, .search-wrapper { transition: none; }
}

/* Small typography tweaks on very narrow screens */
@media (max-width: 380px){
  .card-title{ font-size: 1rem; }
  .chip{ padding: 8px 12px; }
}


