/* ==========================================================================
   Ionikos Hotel · modern layer
   Loaded after the inline styles and coast.css, so it refines rather than
   replaces. Uses custom properties, fluid type (clamp), color-mix(),
   container queries, :has(), scroll-driven animations and view transitions,
   each with a sensible fallback for older browsers.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Palette: Aegean teal + warm sand + sunset gold */
  --ink: #12363b;
  --ink-soft: #3d5f61;
  --teal: #1d5458;
  --teal-deep: #0f2f33;
  --sea: #2f7f86;
  --sand-50: #fbf9f4;
  --sand-100: #f4efe4;
  --sand-200: #e9e3d4;
  --gold: #e2b778;
  --gold-ink: #7a5318;          /* gold dark enough for text on light bg (≥4.5:1) */
  --ok: #1f6b47;
  --err: #a23b2a;

  /* Override the older tokens so existing rules pick up the new palette */
  --navy: var(--ink);
  --navy-soft: var(--teal);
  --text: #1c2b2d;
  --muted: #55686a;             /* 5.6:1 on --sand-50 */
  --line: color-mix(in srgb, var(--ink) 12%, transparent);

  /* Fluid type scale */
  --step--1: clamp(0.82rem, 0.79rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-3: clamp(2.1rem, 1.6rem + 2.4vw, 3.6rem);

  /* Fluid spacing */
  --space-section: clamp(3.5rem, 2rem + 6vw, 7rem);
  --radius: 14px;
  --radius-lg: 22px;

  --shadow-1: 0 1px 2px rgb(18 54 59 / 0.06), 0 2px 8px rgb(18 54 59 / 0.05);
  --shadow-2: 0 2px 4px rgb(18 54 59 / 0.05), 0 14px 34px rgb(18 54 59 / 0.12);
  --shadow-3: 0 30px 70px rgb(15 47 51 / 0.22);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.35s;

  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Smooth cross-page transitions (Chrome/Edge/Safari 18+; ignored elsewhere) */
@view-transition { navigation: auto; }

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

body {
  background: var(--sand-50);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

::selection { background: color-mix(in srgb, var(--gold) 55%, white); color: var(--teal-deep); }

:focus-visible {
  outline: 3px solid var(--sea);
  outline-offset: 3px;
  border-radius: 4px;
}
a:focus-visible, button:focus-visible { font-size: inherit; }

/* ---------- Sections & headings ---------- */
.section { padding-block: var(--space-section); }

.section h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-3);
  line-height: 1.06;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.section-header p { color: var(--muted); font-size: var(--step-0); max-width: 60ch; }

.eyebrow, .hero-kicker { font-weight: 600; color: var(--gold-ink); }
.hero-kicker { color: #fff; }

/* ---------- Header: frosted glass once scrolled ---------- */
.site-header,
.site-header.scrolled {
  background: color-mix(in srgb, var(--sand-50) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  transition: box-shadow var(--dur) var(--ease-out), background-color var(--dur);
}
.site-header.scrolled { box-shadow: 0 6px 24px rgb(18 54 59 / 0.08); }

.nav-menu a {
  position: relative;
  border-radius: 8px;
  transition: color var(--dur), background-color var(--dur);
}
.nav-menu a::after {
  content: "";
  position: absolute;
  inset: auto 0.7rem 0.3rem;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
}
.nav-menu a:hover::after, .nav-menu a.active::after { transform: scaleX(1); }
.site-header .nav-menu a.active,
.site-header.scrolled .nav-menu a.active { background: transparent; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 48px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  transition:
    transform var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out),
    background-color var(--dur),
    color var(--dur),
    border-color var(--dur);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 8px 20px rgb(29 84 88 / 0.25); }
.btn-primary:hover { background: var(--teal-deep); color: #fff; box-shadow: 0 12px 28px rgb(29 84 88 / 0.32); }

.hero .btn-primary { background: var(--sand-100); color: var(--teal-deep); }
.hero .btn-primary:hover { background: #fff; }

.btn-outline { background: transparent; border: 1.5px solid color-mix(in srgb, var(--ink) 28%, transparent); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Hero ---------- */
.hero h1 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.035em; }
.hero-slider .slide { transition: opacity 1.1s ease, transform 7s linear; }
.hero-slider .slide.active { transform: scale(1.04); }
.scene-picker button { transition: border-color var(--dur), opacity var(--dur); opacity: 0.8; }
.scene-picker button:hover, .scene-picker button[aria-pressed="true"] { opacity: 1; }

/* ---------- About features ---------- */
.feature-item {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  padding: 1rem 1.15rem;
  border-left: 3px solid var(--gold);
  box-shadow: none;
}

/* ---------- Cards (rooms + services) ---------- */
.rooms { background: var(--sand-100); }

.rooms-grid, .services-grid { gap: clamp(1rem, 0.6rem + 1.4vw, 1.75rem); }

.room-card, .service-card {
  container-type: inline-size;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}
.room-card:hover, .service-card:hover,
.room-card:has(:focus-visible), .service-card:has(:focus-visible) {
  transform: translateY(-6px);
  box-shadow: var(--shadow-2);
}

.room-media, .service-image { overflow: hidden; }
.room-media img, .service-image img {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-out);
}
.room-card:hover .room-media img,
.service-card:hover .service-image img { transform: scale(1.06); }

.room-badge {
  background: color-mix(in srgb, var(--teal-deep) 78%, transparent);
  color: #fff;
  backdrop-filter: blur(8px);
  border-radius: 999px;
  font-weight: 600;
}

.room-card h3, .service-card h3 { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.room-price span { color: var(--gold-ink); font-family: var(--font-display); }
.room-tags span { background: var(--sand-100); color: var(--ink-soft); border-radius: 999px; }

/* Container query: very narrow cards stack header + full-width buttons */
@container (max-width: 300px) {
  .room-header { flex-direction: column; align-items: flex-start; }
  .room-actions { flex-direction: column; }
  .room-actions .btn { width: 100%; }
}

/* ---------- Gallery ---------- */
.gallery-stage { border-radius: var(--radius-lg); box-shadow: var(--shadow-2); overflow: hidden; }
#mainGalleryImage { transition: opacity 0.4s ease; }
.gallery-btn { transition: transform var(--dur) var(--ease-out), background-color var(--dur); }
.gallery-btn:hover { transform: scale(1.08); }
.thumb { border-radius: var(--radius); overflow: hidden; transition: transform var(--dur) var(--ease-out), box-shadow var(--dur); }
.thumb:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.thumb.active { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Questions section (new) ---------- */
.questions { background: linear-gradient(180deg, var(--sand-50), var(--sand-100)); }

.questions-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 1rem + 3vw, 4rem);
  align-items: start;
}

.questions-aside .section-header { margin-bottom: 1.5rem; }

.quick-topics { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.quick-topics li {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.quick-topics .qt-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--gold) 28%, white);
  color: var(--gold-ink);
  font-weight: 700;
}
.quick-topics strong { display: block; color: var(--ink); }
.quick-topics span { color: var(--muted); font-size: var(--step--1); }

.ask-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 0.8rem + 2vw, 2.25rem);
  box-shadow: var(--shadow-2);
}

.ask-form { display: grid; gap: 1.1rem; }
.ask-form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1.1rem; }

.field { display: grid; gap: 0.4rem; }
.field label, .field legend { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.field .opt { font-weight: 400; color: var(--muted); }

.ask-form input,
.ask-form select,
.ask-form textarea {
  font: inherit;
  color: var(--text);
  width: 100%;
  padding: 0.8rem 0.95rem;
  background: var(--sand-50);
  border: 1.5px solid color-mix(in srgb, var(--ink) 22%, transparent);
  border-radius: 10px;
  transition: border-color var(--dur), box-shadow var(--dur), background-color var(--dur);
}
.ask-form textarea { min-height: 9rem; resize: vertical; field-sizing: content; max-height: 24rem; }
.ask-form input:hover, .ask-form select:hover, .ask-form textarea:hover { border-color: color-mix(in srgb, var(--ink) 40%, transparent); }
.ask-form input:focus, .ask-form select:focus, .ask-form textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--sea);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sea) 22%, transparent);
}

/* Only flag fields after the user has interacted with them */
.ask-form :user-invalid { border-color: var(--err); }
.ask-form .field:has(:user-invalid) .hint-error { display: block; }
.hint-error { display: none; color: var(--err); font-size: var(--step--1); }

/* Topic chips: radio buttons styled as pills */
.topics { border: 0; padding: 0; margin: 0; }
.topics legend { margin-bottom: 0.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips label {
  position: relative;
  cursor: pointer;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--ink) 22%, transparent);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ink-soft);
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
}
.chips input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.chips label:hover { border-color: var(--teal); }
.chips label:has(input:checked) { background: var(--teal); border-color: var(--teal); color: #fff; }
.chips label:has(input:focus-visible) { outline: 3px solid var(--sea); outline-offset: 2px; }

.char-count { justify-self: end; font-size: var(--step--1); color: var(--muted); font-variant-numeric: tabular-nums; }

.consent { display: flex; gap: 0.6rem; align-items: flex-start; font-size: var(--step--1); color: var(--muted); }
.consent input { accent-color: var(--teal); width: 1.1rem; height: 1.1rem; margin-top: 0.15rem; flex: none; }

.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.form-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; justify-content: space-between; }
.form-actions small { color: var(--muted); }
.form-actions small a { color: var(--teal); font-weight: 600; }

.ask-form button[type="submit"] { position: relative; }
.ask-form.is-sending button[type="submit"] { pointer-events: none; opacity: 0.75; }
.ask-form.is-sending button[type="submit"]::after {
  content: "";
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-status {
  display: none;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  font-weight: 500;
}
.form-status.is-visible { display: block; animation: pop 0.35s var(--ease-out); }
.form-status.ok { background: color-mix(in srgb, var(--ok) 12%, white); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, white); }
.form-status.err { background: color-mix(in srgb, var(--err) 10%, white); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 30%, white); }
.form-status a { color: inherit; font-weight: 700; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Contact: match the teal palette ---------- */
.contact { background: radial-gradient(120% 80% at 10% 0%, var(--teal) 0%, var(--teal-deep) 60%); }
.contact .eyebrow { color: var(--gold) !important; background: transparent !important; }
.contact .btn-primary { background: var(--gold); color: var(--teal-deep); }
.contact .btn-primary:hover { background: #f0cf9d; color: var(--teal-deep); }
.contact-panel, .contact-map { border-radius: var(--radius-lg); }
.contact-item { border-radius: var(--radius); transition: background-color var(--dur); }
.contact-item:hover { background: rgb(255 255 255 / 0.1); }
.contact-icon { background: rgb(226 183 120 / 0.2); color: var(--gold); border-radius: 12px; }
.contact-item a:hover, .footer-row a { color: var(--gold); }

.site-footer { background: var(--teal-deep); }

/* ---------- Scroll-driven reveal (progressive enhancement) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal, .reveal.visible {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
    @keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .questions-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-slider .slide.active { transform: none; }
}

@media print {
  .site-header, .hero-slider, .contact-map, .ask-card { display: none !important; }
  body { background: #fff; }
}

/* Fallback for browsers without :user-invalid (JS adds .touched on blur) */
.ask-form .touched:invalid { border-color: var(--err); }
.ask-form .field:has(.touched:invalid) .hint-error { display: block; }
