/*
  styles.css — Danish Models International
  Single source of truth. models.css is now empty — all rules live here.

  Sections:
    1.  Variables & reset
    2.  Layout: container, header, nav
    3.  Bureau name
    4.  Dropdown (Contact)
    5.  Hero
    6.  Buttons
    7.  Grid & Cards  (sharp edges, hover description overlay)
    8.  Pile layout   (height fix)
    9.  Profile
   10.  Forms & flash
   11.  About
   12.  Admin utilities
   13.  Intro overlay & back-to-top
   14.  Responsive
   15.  Reduced-motion
*/

/* ─── 1. Variables & reset ─────────────────────────────────────────────── */
:root {
  --max-w:        1200px;
  --accent:       #111;
  --bg:           #efefef;
  --muted:        #8f8f8f;
  --panel:        #ffffff;
  --card-height:  420px;   /* model card image height */
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 1.45;
  color: var(--accent);
  background: var(--bg);
}

/* ─── 2. Layout ─────────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem;
}

.site-header {
  background: transparent;
  padding: 1.25rem 0;
}
.site-header .container {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

/* ─── 3. Bureau name ─────────────────────────────────────────────────────── */
/*
  FIX: removed brittle translateX(-200px).
  margin-left: auto pushes it to the right naturally at any screen size.
*/
.nav-wrap {
  flex: 0 0 auto;
}
.bureau-name {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: #111;
  text-decoration: none;
  display: inline-block;
  line-height: 1;
  /* Align the title's cap-height with the first nav item ("Women") */
  padding-top: .35rem;
  cursor: pointer;
}
.bureau-name:hover { color: #000; text-decoration: none; }

/* Blink/flash of the logo for ~1s when clicked */
@keyframes logo-flash {
  0%, 100% { opacity: 1; }
  20%      { opacity: 0.15; }
  40%      { opacity: 1; }
  60%      { opacity: 0.15; }
  80%      { opacity: 1; }
}
.bureau-name.flashing {
  animation: logo-flash 1s ease;
}

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.main-nav a {
  color: var(--accent);
  text-decoration: none;
  padding: .25rem .5rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .9rem;
}
.main-nav a:hover { color: #000; }

/* ─── 4. Dropdown ───────────────────────────────────────────────────────── */
.main-nav .has-dropdown { position: relative; }
.main-nav .has-dropdown > a {
  position: relative;
  padding: .35rem .6rem;
  background: transparent;
  border-radius: 0;
}
.main-nav .has-dropdown > a .chev {
  margin-left: .4rem;
  display: inline-block;
  font-size: .85rem;
  transform-origin: center;
  transition: transform .18s ease;
}
.main-nav .has-dropdown.open > a .chev { transform: rotate(180deg); }
.main-nav .has-dropdown > a:focus,
.main-nav .has-dropdown > a:hover  { background: transparent; color: var(--accent); outline: none; }
.main-nav .has-dropdown > a:focus-visible { outline: 2px dotted var(--muted); outline-offset: 3px; }

.main-nav .has-dropdown .dropdown {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  background: var(--panel);
  border: 1px solid #e6e6e6;
  padding: .35rem 0;
  min-width: 200px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  z-index: 50;
  /* sharp edges */
  border-radius: 0;
}
.main-nav .has-dropdown .dropdown li  { margin: 0; padding: 0; }
.main-nav .has-dropdown .dropdown a   { display: block; padding: .6rem .9rem; color: var(--accent); text-transform: none; }
.main-nav .has-dropdown.open .dropdown { display: block; }

/* ─── 5. Hero ───────────────────────────────────────────────────────────── */
.hero { padding: 3.5rem 0; text-align: center; }
.hero h2 { font-family: 'Georgia', serif; font-size: 2.4rem; margin: 0 0 .5rem; }
.hero p   { color: var(--muted); margin: 0 0 1rem; }

/* ─── 6. Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .6rem 1rem;
  background: #111;
  color: #fff;
  text-decoration: none;
  border-radius: 0;           /* sharp */
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}
.btn:hover { background: #333; }
.btn-secondary       { background: #666; }
.btn-secondary:hover { background: #444; }
.btn-danger          { background: #b11; }
.btn-danger:hover    { background: #d11; }

/* ─── 7. Grid & Cards ───────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.card {
  background: var(--panel);
  padding: 0;
  border-radius: 0;           /* sharp — no round edges */
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(20,20,20,0.05);
  position: relative;
}

/* Image with taller height */
.card img {
  width: 100%;
  height: var(--card-height);
  object-fit: cover;
  display: block;
  filter: grayscale(100%) contrast(95%);
  transition: filter .35s ease, transform .4s ease;
}
.card .card-link { display: block; position: relative; }

/*
  Hover description overlay — shows name, city, age on hover.
  The data is injected via data-* attributes on .card-link (see roster.html).
*/
.card-link::after {
  content: attr(data-meta);
  white-space: pre;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1.5rem 1.25rem;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.18) 35%, rgba(0,0,0,0) 70%);
  color: #fff;
  font-family: 'Georgia', serif;
  font-size: .9rem;
  letter-spacing: .04em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .28s ease, transform .28s ease;
  pointer-events: none;
  z-index: 3;
}
.card:hover .card-link::after,
.card:focus-within .card-link::after {
  opacity: 1;
  transform: translateY(0);
}

/* Always-visible name, bottom-centered over the image */
.card-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1.5rem 1.25rem;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.18) 35%, rgba(0,0,0,0) 70%);
  color: #fff;
  font-family: 'Georgia', serif;
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: .01em;
  line-height: 1.15;
  text-shadow: 0 1px 10px rgba(0,0,0,0.5);
  pointer-events: none;
  transition: opacity .28s ease;
  z-index: 2;
}
/* On hover the big name fades out; the small name+city overlay takes over */
.card:hover .card-name,
.card:focus-within .card-name {
  opacity: 0;
}

/* Keyboard focus ring */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: box-shadow .18s ease, opacity .18s ease;
  opacity: 0;
}
.card:focus-within::after {
  opacity: 1;
  box-shadow: inset 0 0 0 3px rgba(17,17,17,0.25);
}
.card-link:focus { outline: none; }

/* Color reveal on hover/focus */
.card:hover img,
.card:focus-within img { filter: none; transform: scale(1.03); }

.card .card-body { padding: 1rem; }
.meta { color: var(--muted); font-size: .95rem; }

/* ─── 8. Pile layout ────────────────────────────────────────────────────── */
/*
  FIX: cards were position:absolute inside a container with no height,
  causing silent overflow with many models.
  The PHP template now sets --pile-cards on the element via style="".
  Falls back to 6 if not set.
*/
.grid.pile {
  position: relative;
  display: block;
  min-height: calc(var(--pile-cards, 6) * 40px + var(--card-height) + 8rem);
  padding: 3rem 0 5rem;
}

.grid.pile .card {
  width: 320px;
  max-width: calc(100% - 2rem);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

/* Offsets — supports up to 12 models */
.grid.pile .card:nth-child(1)  { top:   0px; z-index: 20; }
.grid.pile .card:nth-child(2)  { top:  40px; z-index: 19; }
.grid.pile .card:nth-child(3)  { top:  80px; z-index: 18; }
.grid.pile .card:nth-child(4)  { top: 120px; z-index: 17; }
.grid.pile .card:nth-child(5)  { top: 160px; z-index: 16; }
.grid.pile .card:nth-child(6)  { top: 200px; z-index: 15; }
.grid.pile .card:nth-child(7)  { top: 240px; z-index: 14; }
.grid.pile .card:nth-child(8)  { top: 280px; z-index: 13; }
.grid.pile .card:nth-child(9)  { top: 320px; z-index: 12; }
.grid.pile .card:nth-child(10) { top: 360px; z-index: 11; }
.grid.pile .card:nth-child(11) { top: 400px; z-index: 10; }
.grid.pile .card:nth-child(12) { top: 440px; z-index:  9; }

/* ─── 9. Profile & gallery ──────────────────────────────────────────────── */
.profile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
  padding-top: 1rem;
}

/* Main image */
.profile-main-image {
  width: 100%;
  overflow: hidden;
}
.profile-main-image img {
  width: 100%;
  height: 580px;
  object-fit: cover;
  display: block;
  filter: grayscale(100%) contrast(95%);
  transition: opacity .18s ease, filter .35s ease;
}
.profile-main-image img:hover { filter: none; }

/* Thumbnail strip */
.profile-thumbs {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
  flex-wrap: wrap;
}
.thumb-btn {
  padding: 0;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color .18s ease;
}
.thumb-btn img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
  filter: grayscale(100%) contrast(95%);
  transition: filter .25s ease;
}
.thumb-btn:hover img,
.thumb-btn.active img { filter: none; }
.thumb-btn.active     { border-color: var(--accent); }
.thumb-btn:focus      { outline: 2px dotted var(--muted); outline-offset: 2px; }

.profile-details { padding: 0 1rem; }

/* ─── 10. Forms & flash ─────────────────────────────────────────────────── */
.booking-label {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding-left: .75rem;
}
.booking-label strong {
  color: var(--accent);
}
.contact-form { max-width: 560px; }
.admin-form   { max-width: 520px; margin: 1rem 0; }
.admin-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }

label { display: block; margin-top: .75rem; }
input, textarea, select {
  width: 100%;
  padding: .6rem;
  border: 1px solid #e6e2dd;
  border-radius: 0;           /* sharp */
  font-family: inherit;
  font-size: inherit;
}

.flash-wrap { margin-top: 1rem; }
.flash { padding: .75rem; margin-bottom: .5rem; }
.flash.success { background: #f3fff4; border: 1px solid #d8f0d9; color: #1b6b2a; }
.flash.error   { background: #fff3f3; border: 1px solid #f0d8d8; color: #6b1b1b; }
.flash.info    { background: #f3f8ff; border: 1px solid #d8e8f0; color: #1b3b6b; }

/* ─── 11. Measurements table ────────────────────────────────────────────── */
.measurements {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0 1.5rem;
  font-size: .95rem;
}
.measurements th,
.measurements td {
  padding: .5rem .75rem;
  text-align: left;
  border-bottom: 1px solid #e6e2dd;
}
.measurements th {
  width: 45%;
  color: var(--muted);
  font-weight: normal;
  font-style: italic;
}
.measurements td {
  color: var(--accent);
}

/* ─── 12. About ─────────────────────────────────────────────────────────── */
.about-hero { padding: 2rem 0; text-align: center; }
.about-hero h2 { font-size: 1.8rem; margin-bottom: .5rem; }

/* ─── 11b. Measurements table ───────────────────────────────────────────── */
.measurements {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0 1.5rem;
  font-size: .95rem;
}
.measurements th,
.measurements td {
  padding: .45rem .6rem;
  text-align: left;
  border-bottom: 1px solid #e6e2dd;
}
.measurements th {
  color: var(--muted);
  font-weight: normal;
  width: 40%;
  font-style: italic;
}
.measurements td {
  color: var(--accent);
}

/* ─── 12. Admin utilities ───────────────────────────────────────────────── */
/* Use these classes in templates instead of inline style="" */
.admin-section { max-width: 680px; }

/* ─── 13. Intro overlay & back-to-top ───────────────────────────────────── */
.site-intro {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(250,249,247,0.95);
  z-index: 9999;
  pointer-events: auto;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity .35s ease, transform .45s cubic-bezier(.2,.9,.2,1);
}
.site-intro .intro-inner h1 {
  font-family: 'Georgia', serif;
  font-size: 5rem;
  margin: 0;
  color: var(--accent);
  letter-spacing: .02em;
}
.site-intro.visible { opacity: 1; transform: scale(1); }

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 28px;
  width: 44px;
  height: 44px;
  border-radius: 0;           /* sharp */
  border: none;
  background: #111;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  z-index: 999;
}
.back-to-top svg { display: block; }
.back-to-top:focus { outline: 2px solid #fff; outline-offset: 3px; }
.back-to-top.visible { opacity: 1; transform: translateY(0); }

/* ─── 14. Responsive ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .profile { grid-template-columns: 1fr; }
  .profile-main-image img { height: 420px; }
  .card img { height: 300px; }
  .hero h2  { font-size: 1.8rem; }
  .site-header .container { flex-direction: column; align-items: center; }
  .bureau-name { margin-left: 0; margin-top: .5rem; }
  .main-nav ul { flex-direction: row; gap: 1rem; flex-wrap: wrap; }

  /* Mobile dropdown: inline */
  .main-nav .has-dropdown .dropdown {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
    display: none;
  }
  .main-nav .has-dropdown.open .dropdown { display: flex; gap: .5rem; flex-wrap: wrap; }
  .main-nav .has-dropdown .dropdown a   { padding: .4rem .6rem; }

  /* Pile: single column on mobile */
  .grid.pile { min-height: unset; padding: 1rem 0 2rem; }
  .grid.pile .card {
    position: static;
    transform: none;
    left: auto;
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
  }
}

/* ─── 15. Reduced-motion ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .site-intro, .back-to-top, .card img, .card-link::after { transition: none; }
}

/* ─── 12. Crop uploader ─────────────────────────────────────────────────── */
.crop-uploader { margin-top: 1.25rem; }
.crop-uploader-label {
  display: block;
  margin-bottom: .5rem;
}
.crop-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: .6rem;
}
.crop-thumb {
  position: relative;
  width: 90px;
  height: 120px;
  overflow: hidden;
  background: #eee;
  border: 1px solid #e6e2dd;
}
.crop-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.crop-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 0;
}
.crop-thumb-remove:hover { background: #b11; }
.crop-add-btn { margin-top: 0; }

.crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}
.crop-modal[hidden] { display: none; }
.crop-modal-inner {
  background: #fff;
  padding: 1rem;
  max-width: 600px;
  width: 100%;
}
.crop-stage {
  max-height: 70vh;
  background: #222;
}
.crop-stage img { max-width: 100%; display: block; }
.crop-modal-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* ─── 13. Image ordering (edit model) ───────────────────────────────────── */
.image-order-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .5rem;
}
.image-order-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem;
  background: #faf9f7;
  border: 1px solid #e6e2dd;
  cursor: grab;
}
.image-order-item.dragging { opacity: .5; }
.image-order-item img {
  width: 70px;
  height: 90px;
  object-fit: cover;
  display: block;
  filter: grayscale(100%);
}
.image-order-item .drag-handle {
  color: #aaa;
  font-size: 1.1rem;
  cursor: grab;
  user-select: none;
}
.image-order-item .main-badge {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #111;
  color: #fff;
  padding: .15rem .4rem;
}
.image-order-controls {
  margin-left: auto;
  display: flex;
  gap: .3rem;
}
.btn-mini {
  width: 30px;
  height: 30px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  border-radius: 0;
}
.btn-mini:hover { background: #f0ede9; }
.btn-mini-danger { color: #b11; border-color: #e0b4b4; }
.btn-mini-danger:hover { background: #fbeaea; }

/* Crop thumbnail reorder controls */
.crop-thumb { width: 110px; height: auto; }
.crop-thumb img { width: 110px; height: 140px; }
.crop-main-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: #111;
  color: #fff;
  padding: .1rem .3rem;
}
.crop-thumb-controls {
  display: flex;
  gap: .2rem;
  margin-top: .3rem;
  justify-content: center;
}
.crop-thumb-controls .btn-mini {
  width: 24px;
  height: 24px;
  font-size: .75rem;
}

/* Instagram icon in nav — matches theme accent color */
.main-nav .instagram-link {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  padding: .25rem .5rem;
}
.main-nav .instagram-link:hover { color: var(--muted); }
.main-nav .instagram-link svg { display: block; }
