/* themes/melvin/assets/css/site.css */

    /* Palette drawn from "Hijo de los días" (oil on canvas, 2025):
       marigold burst on a pale sky ground, cobalt streamers, vermilion confetti,
       navy for the figure. Yellow is a FILL, never text — it sits at 1.6:1 on the
       ground. Navy on marigold is 8.7:1, which is what makes the buttons work. */
    :root {
      --bg: #EEF2F5;
      --surface: #E2E9EE;
      --surface-2: #D5DFE6;
      --border: #C7D3DC;
      --text: #16233A;
      --muted: #55657D;
      --accent: #F5B711;
      --accent-deep: #DBA00C;
      --cobalt: #1B4FA0;
      --cobalt-deep: #143C7C;
      --vermilion: #E8622A;

      --radius-sm: 4px;
      --radius-md: 8px;
      --radius-full: 9999px;

      --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
      --font-display: 'Playfair Display', Georgia, serif;

      --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
      --maxw: 1180px;
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html { scroll-behavior: smooth; }

    body {
      font-family: var(--font-sans);
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      line-height: 1.65;
      -webkit-font-smoothing: antialiased;
    }

    ::selection { background: var(--accent); color: var(--text); }

    img { max-width: 100%; display: block; }

    .wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

    /* ── Navigation ── */
    .nav {
      position: fixed;
      top: 0; left: 0; right: 0;
      z-index: 100;
      padding: 1rem 1.5rem;
      background: rgba(238, 242, 245, 0.88);
      backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1.25rem;
    }

    .nav-logo {
      font-family: var(--font-display);
      font-size: 1.35rem;
      font-weight: 600;
      letter-spacing: 0.02em;
      color: var(--text);
      text-decoration: none;
      white-space: nowrap;
    }

    .nav-logo span { color: var(--cobalt); }

    .nav-right { display: flex; align-items: center; gap: 1.5rem; }

    .nav-links {
      display: flex;
      gap: 1.75rem;
      list-style: none;
      align-items: center;
    }

    .nav-links a {
      color: var(--muted);
      text-decoration: none;
      font-weight: 500;
      font-size: 0.875rem;
      transition: color 0.2s var(--ease-out);
    }

    .nav-links a:hover, .nav-links a:focus-visible { color: var(--cobalt); }

    /* ── Language toggle ── */
    .lang {
      display: inline-flex;
      border: 1px solid var(--border);
      border-radius: var(--radius-full);
      overflow: hidden;
      background: var(--bg);
    }

    .lang button {
      font-family: inherit;
      font-size: 0.75rem;
      font-weight: 600;
      letter-spacing: 0.06em;
      padding: 0.3rem 0.7rem;
      border: 0;
      background: transparent;
      color: var(--muted);
      cursor: pointer;
      transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
    }

    .lang button:hover { color: var(--text); }
    .lang button[aria-pressed="true"] { background: var(--cobalt); color: #fff; }

    .icon-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 34px; height: 34px;
      border: 1px solid var(--border);
      border-radius: var(--radius-full);
      color: var(--muted);
      transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
    }

    .icon-link:hover, .icon-link:focus-visible { color: var(--cobalt); border-color: var(--cobalt); }
    .icon-link svg { width: 17px; height: 17px; }

    /* ── Buttons ── */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      font-family: inherit;
      font-size: 0.9rem;
      font-weight: 500;
      padding: 0.75rem 1.6rem;
      border: 0;
      border-radius: var(--radius-full);
      background: var(--accent);
      color: var(--text);
      text-decoration: none;
      cursor: pointer;
      transition: background 0.2s var(--ease-out), transform 0.2s var(--ease-out);
    }

    .btn:hover, .btn:focus-visible { background: var(--accent-deep); transform: translateY(-1px); }

    .btn-ghost {
      background: transparent;
      color: var(--cobalt);
      border: 1px solid var(--cobalt);
    }

    .btn-ghost:hover, .btn-ghost:focus-visible { background: var(--cobalt); color: #fff; }

    /* Text link with a vermilion rule, echoing the streamer marks in the painting */
    .rule-link {
      display: inline-flex;
      align-items: center;
      gap: 0.85rem;
      color: var(--cobalt);
      text-decoration: none;
      font-weight: 500;
      font-size: 0.95rem;
      letter-spacing: 0.04em;
    }

    .rule-link::before {
      content: "";
      width: 44px;
      height: 2px;
      background: var(--vermilion);
      transition: width 0.25s var(--ease-out);
    }

    .rule-link:hover::before, .rule-link:focus-visible::before { width: 68px; }

    /* ── Sections ── */
    section { padding: 5.5rem 0; }
    section.alt { background: var(--surface); border-block: 1px solid var(--border); }

    .eyebrow {
      font-size: 0.72rem;
      font-weight: 600;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--cobalt);
      margin-bottom: 0.9rem;
    }

    h2 {
      font-family: var(--font-display);
      font-size: clamp(1.9rem, 4vw, 2.6rem);
      font-weight: 600;
      line-height: 1.15;
      margin-bottom: 1rem;
    }

    h3 {
      font-family: var(--font-display);
      font-size: 1.2rem;
      font-weight: 600;
      margin-bottom: 0.4rem;
    }

    .lede { color: var(--muted); max-width: 56ch; }

    .section-head { margin-bottom: 3rem; }

    /* ── Hero ──
       The marigold wash echoes the burst of light around the torito in
       "Hijo de los días". Kept soft so navy body text stays well above AA. */
    .hero {
      position: relative;
      min-height: 92vh;
      display: flex;
      align-items: center;
      padding-top: 6rem;
      overflow: hidden;
    }

    .hero::before {
      content: "";
      position: absolute;
      top: -18%;
      right: -12%;
      width: min(70vw, 780px);
      aspect-ratio: 1;
      border-radius: 50%;
      background: radial-gradient(circle at 50% 50%,
        rgba(245, 183, 17, 0.92) 0%,
        rgba(245, 183, 17, 0.68) 30%,
        rgba(245, 183, 17, 0.34) 52%,
        rgba(232, 98, 42, 0.14) 68%,
        transparent 78%);
      pointer-events: none;
    }

    .hero .wrap { position: relative; z-index: 1; }

    .hero-name {
      font-family: var(--font-display);
      font-size: clamp(3rem, 9vw, 6rem);
      font-weight: 600;
      line-height: 1.02;
      letter-spacing: -0.015em;
      margin-bottom: 1.1rem;
    }

    .hero-sub {
      font-size: clamp(1rem, 2vw, 1.2rem);
      color: var(--muted);
      letter-spacing: 0.03em;
      margin-bottom: 2.5rem;
    }

    .hero-sub .dot { color: var(--vermilion); margin: 0 0.5rem; }

    /* ── Placeholder tiles ──
       Swap each .tile div for <img class="tile" src="assets/…"> when real work arrives.
       The aspect-ratio and object-fit rules below already cover the img case. */
    .tile {
      position: relative;
      width: 100%;
      aspect-ratio: 4 / 5;
      /* contain, not cover: a painting must never be cropped by the grid.
         Real images will letterbox inside the uniform tile box. */
      object-fit: contain;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background-color: var(--surface-2);
      /* Marigold wash under a cobalt hatch — the painting's two dominant notes. */
      background-image:
        radial-gradient(ellipse at 62% 34%, rgba(245, 183, 17, 0.30) 0%, transparent 58%),
        radial-gradient(ellipse at 22% 76%, rgba(232, 98, 42, 0.12) 0%, transparent 52%),
        repeating-linear-gradient(
          45deg,
          rgba(27, 79, 160, 0.10) 0,
          rgba(27, 79, 160, 0.10) 1px,
          transparent 1px,
          transparent 11px
        );
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }

    .tile::after {
      content: attr(data-placeholder);
      font-size: 0.7rem;
      font-weight: 500;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--muted);
      opacity: 0.6;
    }

    .tile.wide { aspect-ratio: 3 / 2; }
    .tile.tall { aspect-ratio: 3 / 4; }

    /* ── Gallery ── */
    .gallery {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 2rem 1.75rem;
    }

    .piece {
      display: flex;
      flex-direction: column;
      gap: 0.9rem;
      background: none;
      border: 0;
      padding: 0;
      font: inherit;
      color: inherit;
      text-align: left;
      cursor: pointer;
    }

    .piece .tile { transition: transform 0.35s var(--ease-out), border-color 0.25s var(--ease-out); }
    .piece:hover .tile, .piece:focus-visible .tile { transform: translateY(-4px); border-color: var(--cobalt); }

    .piece-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
    .piece-meta { font-size: 0.82rem; color: var(--muted); }

    /* ── Lightbox ── */
    .lightbox {
      position: fixed;
      inset: 0;
      z-index: 200;
      background: rgba(22, 35, 58, 0.94);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 2rem 1.5rem;
    }

    .lightbox[open], .lightbox.is-open { display: flex; }

    .lightbox-inner { max-width: 720px; width: 100%; }
    .lightbox-inner .tile { background-color: #C2CEDA; aspect-ratio: 4 / 5; max-height: 72vh; }
    .lightbox-caption { margin-top: 1rem; color: #EEF2F5; }
    .lightbox-caption .piece-meta { color: rgba(238, 242, 245, 0.75); }

    .lightbox-close {
      position: absolute;
      top: 1.25rem; right: 1.25rem;
      width: 42px; height: 42px;
      border-radius: var(--radius-full);
      border: 1px solid rgba(238, 242, 245, 0.45);
      background: transparent;
      color: #EEF2F5;
      font-size: 1.4rem;
      line-height: 1;
      cursor: pointer;
    }

    .lightbox-close:hover { background: rgba(238, 242, 245, 0.14); }

    /* ── About ── */
    .about-grid {
      display: grid;
      grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
      gap: 3.5rem;
      align-items: start;
    }

    .about-grid p + p { margin-top: 1.1rem; }
    .about-grid .lede { max-width: none; }

    /* ── Commissions ── */
    .steps {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 2rem;
      margin-bottom: 3rem;
    }

    .step { border-top: 3px solid var(--vermilion); padding-top: 1.2rem; }

    .step-num {
      font-family: var(--font-display);
      font-size: 2rem;
      font-weight: 600;
      color: var(--vermilion);
      line-height: 1;
      margin-bottom: 0.6rem;
      display: block;
    }

    .step p { color: var(--muted); font-size: 0.92rem; }

    /* ── Contact ── */
    .contact-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
      gap: 3rem;
      align-items: start;
    }

    .field { margin-bottom: 1.1rem; }

    label {
      display: block;
      font-size: 0.78rem;
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--muted);
      margin-bottom: 0.4rem;
    }

    input, textarea {
      width: 100%;
      font-family: inherit;
      font-size: 0.95rem;
      color: var(--text);
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 0.7rem 0.9rem;
      transition: border-color 0.2s var(--ease-out);
    }

    input:focus, textarea:focus { outline: 0; border-color: var(--cobalt); }
    textarea { resize: vertical; min-height: 130px; }

    .form-status {
      display: none;
      margin-top: 1rem;
      padding: 0.85rem 1rem;
      border-radius: var(--radius-md);
      font-size: 0.9rem;
    }

    .form-status.show { display: block; }
    .form-status.ok { background: rgba(27, 79, 160, 0.08); border: 1px solid var(--cobalt); color: var(--cobalt); }
    .form-status.err { background: rgba(155, 40, 40, 0.08); border: 1px solid #9B2828; color: #8A2222; }

    .contact-list { list-style: none; display: flex; flex-direction: column; gap: 1.4rem; }

    .contact-item { display: flex; gap: 0.9rem; align-items: flex-start; }
    .contact-item svg { width: 19px; height: 19px; color: var(--cobalt); flex-shrink: 0; margin-top: 3px; }
    .contact-item .k { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
    .contact-item a { color: var(--text); text-decoration: none; font-weight: 500; }
    .contact-item a:hover, .contact-item a:focus-visible { color: var(--cobalt); }

    /* ── Footer ── */
    footer {
      border-top: 1px solid var(--border);
      padding: 2.5rem 0;
      font-size: 0.85rem;
      color: var(--muted);
    }

    .footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; }

    /* ── Accessibility ── */
    :focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }

    .skip {
      position: absolute;
      left: -9999px;
      top: 0;
      background: var(--cobalt);
      color: #fff;
      padding: 0.6rem 1rem;
      z-index: 300;
    }

    .skip:focus { left: 0; }

    @media (prefers-reduced-motion: reduce) {
      html { scroll-behavior: auto; }
      *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
    }

    /* ── Responsive ── */
    @media (max-width: 860px) {
      .about-grid { grid-template-columns: 1fr; gap: 2.25rem; }
    }

    @media (max-width: 700px) {
      .nav { padding: 0.75rem 1rem; }
      .nav-links { display: none; }
      .nav-right { gap: 0.75rem; }
      section { padding: 4rem 0; }
      .hero { min-height: auto; padding: 8rem 0 4rem; }
    }
  
    /* ── Foundry port additions ──
       Real images use <img class="tile">; they take the same box and rules as the placeholder. */
    img.tile { display: block; }

    /* Lightbox: an image replaces the placeholder tile when one is uploaded */
    .lightbox-media img.tile { display: none; }
    .lightbox-media img.tile.is-shown { display: block; }
    .lightbox-media .tile.is-hidden { display: none; }
    .lightbox-link { margin-top: 0.75rem; display: inline-block; color: #EEF2F5; font-size: 0.9rem; }
    /* The link stays hidden unless the page sets hidden off. Without this, display above wins over the hidden attribute. */
    .lightbox-link[hidden] { display: none; }

    /* Painting page (one page per painting) */
    .painting-page { padding: 7.5rem 0 5rem; min-height: 100vh; }
    .painting-page .back { margin-bottom: 2.5rem; }
    .painting-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 3rem; align-items: start; }
    .painting-grid > * { min-width: 0; }
    .painting-grid .tile { max-height: 80vh; }
    .painting-title { font-family: var(--font-display); font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 600; line-height: 1.15; margin-bottom: 0.75rem; }
    .painting-page .piece-meta { font-size: 0.95rem; }

    /* Footer on the painting page */
    .painting-page + footer { margin-top: 0; }

    @media (max-width: 700px) {
      .painting-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
    }


