/* ---------------------------------------------
   Tokens
--------------------------------------------- */
:root {
  --ink:        #1D1D1F;   /* primary text */
  --paper:      #FFFFFF;   /* page background */
  --panel:      #F5F5F7;   /* light grey panel / card background */
  --line:       #D2D2D7;   /* hairline borders */
  --mid:        #86868B;   /* secondary text */
  --dark:       #1D1D1F;   /* near-black, used for dark surfaces */
  --selected:   #E8E8ED;   /* selected frame background */

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Serif 4', Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------
   Masthead
--------------------------------------------- */
.masthead {
  background: var(--paper);
  color: var(--ink);
  padding: 4.5rem 2rem 3rem;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid);
  margin: 0 0 0.75rem;
}

.masthead h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  margin: 0 0 0.85rem;
  letter-spacing: -0.01em;
}

.masthead .sub {
  max-width: 34em;
  margin: 0 auto;
  color: var(--mid);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ---------------------------------------------
   Layout: gallery + order panel
--------------------------------------------- */
.order-form {
  display: grid;
  grid-template-columns: 1fr 300px;
  align-items: start;
  gap: 3rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.contact-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2.5rem 1.75rem;
}

.empty {
  grid-column: 1 / -1;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--mid);
  border: 1px dashed var(--line);
  padding: 2rem;
  text-align: center;
  border-radius: 4px;
}

/* ---------------------------------------------
   Frame (single photo unit)
--------------------------------------------- */
.frame-body {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.75rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.frame:has(.select-check:checked) .frame-body {
  background: var(--selected);
  border-color: var(--ink);
}

.check-zone {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 2;
  cursor: pointer;
}

.select-check {
  position: absolute;
  opacity: 0;
  width: 1.4rem;
  height: 1.4rem;
  margin: 0;
  cursor: pointer;
}

.check-mark {
  display: block;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--paper);
  position: relative;
}

.select-check:checked + .check-mark {
  background: var(--ink);
  border-color: var(--ink);
}

.select-check:checked + .check-mark::after {
  content: '';
  position: absolute;
  left: 0.42rem;
  top: 0.2rem;
  width: 0.32rem;
  height: 0.62rem;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.select-check:focus-visible + .check-mark {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.frame-no {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--mid);
  margin-bottom: 0.6rem;
}

.thumb {
  width: 100%;
  object-fit: cover;
  border-radius: 2px;
  background: var(--panel);
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

.thumb:hover {
  opacity: 0.88;
}

.thumb.landscape {
  aspect-ratio: 3 / 2;
}

.thumb.portrait {
  aspect-ratio: 2 / 3;
}

/* ---------------------------------------------
   Lightbox
--------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 100;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 2.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.lightbox-close:hover {
  color: var(--mid);
}

.sizes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.size-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.35rem 0.5rem;
  background: var(--paper);
}

.qty-input {
  width: 2.6rem;
  border: none;
  border-left: 1px solid var(--line);
  padding-left: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: right;
  background: transparent;
  color: var(--ink);
}

.qty-input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* ---------------------------------------------
   Order panel
--------------------------------------------- */
.order-panel {
  position: sticky;
  top: 1.5rem;
}

.order-panel-inner {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.75rem;
}

.order-panel-inner .eyebrow { color: var(--mid); }

.order-panel-inner h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0.1rem 0 0.5rem;
}

.order-count {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--mid);
  margin: 0 0 1.5rem;
}

.contact-fields {
  border: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.contact-fields legend {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--mid);
  padding: 0 0 0.7rem;
}

.contact-fields label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.9rem;
  color: var(--ink);
}

.optional {
  color: var(--mid);
  font-weight: 400;
}

.contact-fields input,
.contact-fields textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.contact-fields input:focus,
.contact-fields textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.submit-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 3px;
  padding: 0.8rem 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

.submit-btn:hover { background: #3a3a3c; }

/* ---------------------------------------------
   Order result pages (order.php)
--------------------------------------------- */
.result-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--paper);
}

.result-card {
  max-width: 34rem;
  width: 100%;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2.5rem;
}

.result-card h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0 0 1rem;
}

.result-card p { line-height: 1.6; color: var(--mid); }

.error-list { color: #A02020; }

.order-summary {
  margin: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 0;
}

.order-summary h2 {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--mid);
  margin: 0 0 0.75rem;
}

.order-summary ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--ink);
}

.order-summary li { margin-bottom: 0.4rem; }

.order-summary .total {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

/* ---------------------------------------------
   Responsive
--------------------------------------------- */
@media (max-width: 860px) {
  .order-form {
    grid-template-columns: 1fr;
    padding: 1.5rem 1.25rem 3rem;
  }

  .order-panel {
    position: static;
  }

  .contact-sheet {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.75rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .frame-body { transition: none; }
}