/* ============================================================
   Ben Loves Puerto Rico — Design Candidate A
   Direction: warm editorial magazine (Afar / Monocle travel feature)
   Generous serif type, cream / espresso / terracotta palette,
   restrained rhythm, mobile-first.
   ============================================================ */

:root {
  --paper:        #f7f1e4;   /* cream page ground */
  --paper-alt:     #efe4d1;  /* deeper cream, used for boxed asides */
  --card:          #fffdf8;  /* card / panel surface */
  --ink:           #2b2116;  /* espresso */
  --ink-soft:      #6d5f4d;  /* soft espresso for secondary text */
  --rule:          #ddccac;  /* hairline rule / border */
  --rule-soft:     #e7dac0;
  --terracotta:      #c1602c;
  --terracotta-deep: #93441c;
  --sand:          #e8dcc0;
  --maxw: 700px;
  --serif-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --serif-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans-utility: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.72 var(--serif-body);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* ---------- masthead (brand + nav) — nav-C: areas-forward, hamburger+accordion ---------- */

.masthead {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

header.site {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 0.7rem;
  text-align: center;
}

header.site .brand {
  display: inline-block;
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

header.site .brand span {
  color: var(--terracotta);
  font-style: normal;
}

/* hamburger — mobile-only trigger for the slide-down accordion */
.hamburger {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 5px;
  cursor: pointer;
}
.hamburger span {
  display: block;
  width: 19px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* nav — mobile: hidden slide-down accordion opened by the hamburger */
nav.site {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--rule);
  background: var(--card);
}
nav.site.nav-open { display: flex; }

nav.site > a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.6rem 1.2rem;
  font-family: var(--sans-utility);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-soft);
}
nav.site > a:hover,
nav.site > a.here { color: var(--terracotta-deep); }

/* each top-level group is a <details> — native tap-to-expand accordion,
   no JS required for the expand/collapse itself */
details.navdrop {
  border-bottom: 1px solid var(--rule-soft);
}
details.navdrop summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
  padding: 0.6rem 1.2rem;
  font-family: var(--sans-utility);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
details.navdrop summary::-webkit-details-marker { display: none; }
details.navdrop summary .car {
  font-size: 0.62rem;
  color: var(--terracotta);
  transition: transform 0.15s ease;
}
details.navdrop[open] summary .car { transform: rotate(180deg); }
details.navdrop summary:hover,
details.navdrop summary.grouphere { color: var(--terracotta-deep); }

.panel {
  display: none;
  flex-direction: column;
  padding: 0 1.2rem 0.5rem 1.7rem;
}
details.navdrop[open] > .panel { display: flex; }
.panel a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.4rem 0;
  font-family: var(--sans-utility);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-decoration: none;
}
.panel a:hover { color: var(--terracotta-deep); }
.panel a.chere { color: var(--terracotta-deep); font-weight: 700; }

@media (min-width: 700px) {
  .hamburger { display: none; }

  nav.site {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0.3rem 1.5rem;
    padding: 0.6rem 1.5rem 1.05rem;
    border-top: none;
    background: transparent;
  }

  nav.site > a {
    min-height: auto;
    padding: 0.15rem 0 0.4rem;
    border-bottom: 2px solid transparent;
  }
  nav.site > a:hover,
  nav.site > a.here { border-bottom-color: var(--terracotta); }

  details.navdrop { position: relative; flex: 0 0 auto; border-bottom: none; }
  details.navdrop summary {
    min-height: auto;
    padding: 0.15rem 0 0.4rem;
    border-bottom: 2px solid transparent;
  }
  details.navdrop summary.grouphere,
  details.navdrop[open] summary,
  details.navdrop:hover summary { border-bottom-color: var(--terracotta); color: var(--terracotta-deep); }

  .panel {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 40;
    min-width: 15rem;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 0.5rem 0.2rem;
    box-shadow: 0 10px 24px rgba(43, 33, 22, 0.16);
  }
  .panel a { min-height: auto; padding: 0.42rem 1.1rem; white-space: nowrap; }

  /* hover-open in addition to native click-open via [open] */
  details.navdrop:hover > .panel,
  details.navdrop:focus-within > .panel { display: flex; }
}

/* ---------- hero ---------- */

.hero { position: relative; background: var(--ink); }
.hero img {
  width: 100%;
  height: 46vh;
  min-height: 260px;
  max-height: 520px;
  object-fit: cover;
  display: block;
  filter: saturate(0.94) contrast(1.03);
}
.hero .title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 3.4rem 1.3rem 1.9rem;
  background: linear-gradient(to top, rgba(24,16,9,0.94), rgba(24,16,9,0.35) 60%, rgba(24,16,9,0) 100%);
  color: #fdf7ec;
  text-align: center;
}
.hero .title h1 {
  margin: 0;
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 7vw, 3.2rem);
  line-height: 1.06;
  max-width: 20ch;
  margin-left: auto;
  margin-right: auto;
  text-shadow: 0 2px 14px rgba(0,0,0,0.55);
}
.hero .title p {
  margin: 0.55rem 0 0;
  font-family: var(--sans-utility);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #f0c9a1;
}

/* ---------- reading column ---------- */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.25rem 3.2rem;
}

main > h2:first-child {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  line-height: 1.12;
  margin: 0.2rem 0 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}

h2 {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 2.6rem 0 0.85rem;
  color: var(--ink);
}
h2:first-child { margin-top: 0.2rem; }

h3 { font-family: var(--serif-display); font-weight: 600; }

main p { margin: 0 0 1.2rem; }

/* opening drop cap — the first paragraph of every page's prose,
   regardless of whether it follows a hero or a plain h2 title */
main > p:first-of-type::first-letter {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 3.6em;
  line-height: 0.78;
  float: left;
  padding: 0.04em 0.09em 0 0;
  color: var(--terracotta-deep);
}

main p strong:first-child {
  color: var(--terracotta-deep);
  letter-spacing: 0.01em;
}

main a { color: var(--terracotta-deep); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
main a:hover { color: var(--terracotta); }

main img.ph { width: 100%; border-radius: 3px; margin: 0.7rem 0 0.2rem; }
figure { margin: 1.3rem 0; }
figcaption, .cap {
  font-family: var(--sans-utility);
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-bottom: 1.1rem;
}

/* ---------- boxed asides: kept unmistakably apart from body prose ---------- */

.factcheck {
  background: var(--paper-alt);
  border-left: 3px solid var(--terracotta);
  border-radius: 0 3px 3px 0;
  padding: 0.85rem 1.05rem;
  margin: 1rem 0 1.5rem;
  font-family: var(--sans-utility);
  font-size: 0.85rem;
  line-height: 1.58;
  color: var(--ink-soft);
}
.factcheck span {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--terracotta-deep);
  margin-bottom: 0.3rem;
}

.tipbox {
  background: var(--sand);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1rem 1.15rem;
  margin: 1.4rem 0;
  font-family: var(--sans-utility);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
}
.tipbox strong:first-child {
  display: block;
  color: var(--terracotta-deep);
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  margin-bottom: 0.4rem;
}

/* ---------- region / index cards ---------- */

.regions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.3rem;
  margin: 1.4rem 0;
}
.regions a.card {
  background: var(--card);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.regions a.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(43, 33, 22, 0.14);
  border-color: var(--terracotta);
}
.regions a.card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  filter: saturate(0.92);
}
.regions a.card .pad { padding: 0.85rem 1rem 1rem; }
.regions a.card h3 {
  margin: 0 0 0.3rem;
  font-size: 1.08rem;
  color: var(--ink);
}
.regions a.card p {
  margin: 0;
  font-family: var(--sans-utility);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.soon { opacity: 0.6; }
.soon .tag {
  font-family: var(--sans-utility);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--terracotta);
}

/* ---------- footer ---------- */

footer.site {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 1.8rem 1.2rem 2.6rem;
  text-align: center;
  font-family: var(--sans-utility);
  font-size: 0.79rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
footer.site a { color: var(--terracotta-deep); }

/* ---------- breakpoints (mobile-first: base above is phone) ---------- */

@media (min-width: 640px) {
  body { font-size: 17.5px; }
  main { padding-top: 2.4rem; }
  .hero .title { padding: 4rem 2rem 2.2rem; }
}

@media (min-width: 900px) {
  :root { --maxw: 760px; }
  body { font-size: 18px; }
  header.site { padding: 1.9rem 1rem 0.8rem; }
  header.site .brand { font-size: 1.75rem; }
  .hero img { height: 54vh; }
  .regions { gap: 1.6rem; }
}
