/* -----------------------------------------------------------------------
 * Arte de la Montaña — simple, uniform, paper-coloured layout.
 * Three sections: Gallery / About / Order. No price, no role chrome.
 * --------------------------------------------------------------------- */
:root {
  --bg:      #ffffff;
  --paper:   #fffdf6;
  --ink:     #221d18;
  --ink-2:   #5a5145;
  --line:    #e0d6c2;
  --accent:  #a3502a;
  --max:     1080px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 "Inter", "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}

h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; font-weight: 600; margin: 0 0 .4em; letter-spacing: -.005em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; background: none; border: 1px solid var(--ink); padding: .55rem 1.1rem; border-radius: 999px; }
button:hover { background: var(--ink); color: var(--paper); }
button.primary { background: var(--ink); color: var(--paper); }
button.primary:hover { background: var(--accent); border-color: var(--accent); }

/* ============================  HEADER  =============================== */
#topbar {
  display: flex; align-items: center; gap: 2rem;
  padding: 1rem 2rem;
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 253, 246, .9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 600; font-family: "Playfair Display", serif; font-size: 1.15rem; }
.brand img { width: 36px; height: 36px; }
.brand:hover { text-decoration: none; }

#topbar nav { margin-left: auto; display: flex; gap: 1.6rem; }
#topbar nav a {
  color: var(--ink-2); padding: .25rem 0;
  border-bottom: 2px solid transparent;
}
#topbar nav a.active { color: var(--ink); border-color: var(--ink); }
#topbar nav a:hover { color: var(--ink); text-decoration: none; }

/* ============================  VIEWS  ================================ */
.view { display: none; max-width: var(--max); margin: 0 auto; padding: 2.5rem 2rem 4rem; }
.view.active { display: block; }

/* ============================  GALLERY  ============================== */
.hero { text-align: center; margin-bottom: 3rem; }
.hero-banner-wrap { position: relative; margin-bottom: 1.5rem; }
.hero-banner {
  display: block; width: 100%; max-height: 360px; object-fit: cover;
  border: 1px solid var(--line);
}
.hero-title {
  position: absolute; left: 5%; top: 50%; transform: translateY(-50%);
  width: 46%; max-width: 460px; margin: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.25));
}
.hero-subtitle { max-width: 360px; width: 60%; opacity: .85; }

@media (max-width: 500px) {
  .hero-title { width: 60%; left: 4%; }
}

/* Masonry columns — every piece shown whole, at its natural shape. */
.grid {
  column-count: 4;
  column-gap: 16px;
}
.tile {
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  overflow: hidden; cursor: pointer;
  position: relative;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  transition: transform .18s ease, box-shadow .18s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(34, 29, 24, .15); }
.tile img { width: 100%; height: auto; display: block; }

/* Tile footprint scales with the piece's size tag, so a small bookmark
 * doesn't blow up to the same width as a large canvas. Narrower tiles are
 * centred within their masonry column. */
.tile[data-size="extralarge"] { display: block; width: 100%; margin-left: auto; margin-right: auto; }
.tile[data-size="large"]      { display: block; width: 88%;  margin-left: auto; margin-right: auto; }
.tile[data-size="medium"]     { display: block; width: 68%;  margin-left: auto; margin-right: auto; }
.tile[data-size="small"]      { display: block; width: 46%;  margin-left: auto; margin-right: auto; }
.tile .caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: .55rem .8rem; font-size: .82rem; color: var(--paper);
  background: linear-gradient(to top, rgba(34,29,24,.78), transparent);
  opacity: 0; transition: opacity .18s ease;
  font-family: "Playfair Display", serif;
}
.tile:hover .caption { opacity: 1; }

/* ============================  ABOUT  ================================ */
#view-about {
  background: var(--bg);
  padding-top: 3rem;
}
.about-hero {
  display: flex; justify-content: center; align-items: center; margin-bottom: 2.5rem;
}
.about-subtitle { width: 60%; max-width: 320px; }

.about-body {
  display: grid; grid-template-columns: 280px 1fr; gap: 2rem; align-items: center;
  margin-bottom: 3rem;
}
.about-portrait { width: 100%; border: 1px solid var(--line); }

.about-row {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 2rem; align-items: center; margin-bottom: 3rem;
}
.about-row img { width: 100%; border: 1px solid var(--line); }
.about-row .stencil { display: block; max-width: 220px; margin-top: 1.2rem; border: none; opacity: .7; }

.signature-row { text-align: center; margin-top: 2rem; }
.signature-row img { max-width: 240px; opacity: .85; }

/* ============================  ORDER  ================================ */
.order-title { display: block; width: 60%; max-width: 300px; margin: 0 0 1rem; }
.order-mode {
  display: flex; flex-wrap: wrap; gap: 1.5rem; border: none; margin: 0 0 1.4rem; padding: 0;
}
.order-mode label {
  display: flex; align-items: center; gap: .45rem; font-size: .95rem; color: var(--ink); cursor: pointer;
}
.order-mode input { accent-color: var(--accent); }
#order-references { font: inherit; color: var(--ink-2); }
#view-order h2 { font-size: 2rem; margin-bottom: .25rem; }
#view-order .lede { color: var(--ink-2); margin-bottom: 2rem; }

#order-form {
  background: #d9cbbd;
  padding: 1.8rem 2rem; border: 1px solid var(--line);
}
.form-grid {
  display: grid; gap: 1rem 1.4rem;
  grid-template-columns: 1fr 1fr;
}
.form-grid label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color: var(--ink-2); }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid label[hidden] { display: none; }
.form-grid input, .form-grid select, .form-grid textarea {
  font: inherit; color: var(--ink);
  padding: .55rem .7rem; border: 1px solid var(--line); background: #fff;
  border-radius: 4px;
}
.form-grid select[multiple] { padding: .3rem; font-family: "Playfair Display", serif; }
.form-grid small { color: var(--ink-2); font-size: .78rem; }
.actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.4rem; }

#view-order h3 { margin-top: 2.5rem; }
.hint { color: var(--ink-2); font-size: .9rem; }
.orders { list-style: none; padding: 0; margin: 1rem 0 0; }
.orders li {
  background: var(--paper); border: 1px solid var(--line); padding: .8rem 1rem;
  margin-bottom: .6rem; display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem;
  align-items: baseline;
}
.orders .meta { font-size: .8rem; color: var(--ink-2); }
.orders .pieces { grid-column: 1 / -1; font-size: .88rem; color: var(--ink-2); }
.orders .pieces strong { color: var(--ink); font-weight: 500; }

/* ============================  STUDIO (hidden)  ====================== */
.studio-login { max-width: 360px; margin: 4rem auto; background: var(--paper); border: 1px solid var(--line); padding: 2rem; }
.studio-login h2 { margin-bottom: .3rem; }
.studio-login .lede { color: var(--ink-2); margin-bottom: 1.5rem; }

.studio-form { display: flex; flex-direction: column; gap: 1rem; }
.studio-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--ink-2); }
.studio-form input, .studio-form select, .studio-form textarea {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); background: #fff; border-radius: 4px;
}
.studio-form .actions { flex-direction: row; justify-content: space-between; align-items: center; }
.studio-form .actions a { font-size: .9rem; color: var(--ink-2); }

.studio-form-wide .form-grid { display: grid; gap: .8rem 1.2rem; grid-template-columns: 1fr 1fr; }
.studio-form-wide .form-grid label.full { grid-column: 1 / -1; }
.studio-form-wide .actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }

.studio-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.studio-tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.studio-tabs button { padding: .45rem .9rem; border-radius: 4px; }
.studio-tabs button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.studio-toolbar { display: flex; gap: .5rem; align-items: center; margin-bottom: .9rem; }
.studio-toolbar span { flex: 1; }

.studio-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); }
.studio-table th, .studio-table td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; font-size: .9rem; vertical-align: top; }
.studio-table th { background: var(--bg); }
.studio-table img { width: 42px; height: 42px; object-fit: cover; }
.studio-table .meta { font-size: .78rem; color: var(--ink-2); }
.studio-table td button { font-size: .8rem; padding: .25rem .65rem; margin-right: .25rem; }

/* ============================  DETAIL MODAL  ========================= */
#modal-root { position: fixed; inset: 0; z-index: 100; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(30, 24, 18, .55); }
.modal {
  position: relative; max-width: 880px; margin: 5vh auto; background: var(--paper);
  padding: 0; max-height: 90vh; display: flex; flex-direction: column;
  border: 1px solid var(--line); box-shadow: 0 30px 60px rgba(0,0,0,.25);
}
#modal-close {
  position: absolute; top: .6rem; right: .6rem;
  width: 36px; height: 36px; padding: 0; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: 1.3rem; line-height: 1;
}
#modal-body { padding: 0; overflow: auto; }

.detail { display: grid; grid-template-columns: 1.1fr 1fr; }
.detail .image { background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 1.4rem; }
.detail .image img { max-width: 100%; max-height: 70vh; }
.view-toggle { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.view-toggle button { padding: .35rem .9rem; font-size: .82rem; border-radius: 999px; }
.view-toggle button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.detail .story { color: var(--ink); font-style: italic; border-left: 2px solid var(--line); padding-left: .9rem; margin: 0 0 1.4rem; }
.detail .meta { padding: 2rem 2rem 1.6rem; }
.detail h3 { font-size: 1.6rem; margin-bottom: .2rem; }
.detail .sub { color: var(--ink-2); font-size: .9rem; margin-bottom: 1.2rem; }
.detail dl { display: grid; grid-template-columns: 110px 1fr; gap: .35rem .8rem; margin: 0 0 1.4rem; font-size: .92rem; }
.detail dt { color: var(--ink-2); }
.detail dd { margin: 0; }
.detail .desc { color: var(--ink-2); margin-bottom: 1.4rem; }

/* ============================  FOOTER  =============================== */
footer {
  text-align: center; padding: 3rem 2rem 3rem; font-size: .85rem;
  background: var(--bg); border-top: 1px solid var(--line);
  color: var(--ink-2); margin-top: 4rem;
}
footer p { color: var(--ink-2); }
.footer-img { max-width: 820px; width: 92%; display: block; margin: 0 auto 1.2rem; }

/* ============================  TOASTS  =============================== */
#toast-root { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 200; }
.toast { background: var(--ink); color: var(--paper); padding: .7rem 1rem; max-width: 320px; font-size: .9rem; box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.toast.success { background: #336b3a; }
.toast.error   { background: #8d3333; }

/* ============================  RESPONSIVE  =========================== */
@media (max-width: 800px) {
  .grid { column-count: 3; column-gap: 12px; }
  .about-hero, .about-body, .about-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
  #topbar { padding: 1rem; gap: 1rem; }
  #topbar nav { gap: 1rem; }
}
@media (max-width: 500px) {
  .grid { column-count: 2; }
}
