/*
  Oportunidades PR. The student's sheet gave three references (a summer-camp directory, a
  volunteering search and an entry-level job board) and no colors or fonts, so the theme borrows
  their moods: sunny camp orange, community green, job-board blue, on a Caribbean teal and warm
  sand. Shared baseline first (./shared/base.css), then these tokens override it.
*/

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("./fonts/inter-400-600-latin.woff2") format("woff2");
}

:root {
  --sea: #0B6E79;
  --sea-deep: #08525B;
  --sea-soft: #DDF1F2;
  --sand: #FFF8EE;
  --sun: #FFB547;
  --camp: #B85500;   --camp-soft: #FFEAD3;  --camp-dot: #F28C28;
  --vol: #1F7A44;    --vol-soft: #DCF2E4;   --vol-dot: #3FAE6A;
  --emp: #2B57C4;    --emp-soft: #E2EAFD;   --emp-dot: #5B8DEF;
  --heart: #D63A50;

  --bg: var(--sand);
  --surface: #FFFFFF;
  --surface-2: #F4EDE2;
  --ink: #12263A;
  --ink-2: #536070;
  --line: #E6DDD0;
  --accent: var(--sea);
  --accent-ink: #FFFFFF;
  --accent-soft: var(--sea-soft);
  --good: #1F7A44;
  --warn: #A55A00;
  --bad: #B3261E;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgb(18 38 58 / 6%), 0 8px 24px rgb(18 38 58 / 7%);
  --font: "Inter", ui-sans-serif, -apple-system, system-ui, sans-serif;
  --font-display: var(--font);
  --max: 1120px;
  color-scheme: light;
}

body { background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); margin: 0 0 8px; }
h2 { font-size: 1.25rem; margin: 0 0 8px; }
h3 { font-size: 1.05rem; margin: 0 0 4px; }
p { margin: 0 0 8px; }
a { color: var(--sea); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
.skip-link {
  position: absolute; left: 12px; top: -80px; z-index: 100; padding: 10px 16px;
  background: var(--ink); color: #fff; border-radius: 10px;
}
.skip-link:focus { top: calc(8px + var(--safe-top)); }
.icon {
  width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.muted { color: var(--ink-2); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + var(--safe-top)) calc(16px + var(--safe-right)) 8px calc(16px + var(--safe-left));
  background: var(--sea); color: #fff;
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: #fff; text-decoration: none; font-weight: 600; font-size: 1.1rem; }
.brand img { border-radius: 10px; }
.brand b { color: var(--sun); }
.topbar-profile {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: #fff; background: rgb(255 255 255 / 14%);
}

/* ---------- Tab bar ---------- */
.tabbar { background: color-mix(in srgb, #fff 92%, transparent); }
.tabbar a { font-size: .75rem; }
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--sea); background: var(--sea-soft); }

/* ---------- Buttons and chips ---------- */
.btn { border-color: var(--line); }
.btn.primary { background: var(--sea); }
.btn.primary:hover { background: var(--sea-deep); }
.btn.sunny { background: var(--sun); color: var(--ink); border-color: transparent; }
.btn .icon { width: 20px; height: 20px; }
.chip { min-height: 44px; padding: 0 16px; font-size: .95rem; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.heart-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); cursor: pointer;
}
.heart-btn[aria-pressed="true"] { color: var(--heart); background: #FDE4E8; }
.heart-btn[aria-pressed="true"] .icon { fill: currentColor; }

/* Type colors */
.t-campamento { --t: var(--camp); --t-soft: var(--camp-soft); --t-dot: var(--camp-dot); }
.t-voluntariado { --t: var(--vol); --t-soft: var(--vol-soft); --t-dot: var(--vol-dot); }
.t-empleo { --t: var(--emp); --t-soft: var(--emp-soft); --t-dot: var(--emp-dot); }
.type-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--t-soft); color: var(--t); font-size: .8rem; font-weight: 600;
}
.type-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--t-dot); }
.status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2);
}
.status-pill.soon { background: #FFF0D6; color: var(--warn); }
.status-pill.closed, .status-pill.ended { background: #F9E1DE; color: var(--bad); }
.status-pill.track { background: var(--sea-soft); color: var(--sea-deep); }

/* ---------- Home ---------- */
.hero {
  position: relative; overflow: hidden;
  margin: -16px calc(-16px - var(--safe-right)) 20px calc(-16px - var(--safe-left));
  padding: 24px calc(20px + var(--safe-right)) 76px calc(20px + var(--safe-left));
  background: linear-gradient(180deg, var(--sea) 0%, #12909C 100%); color: #fff;
}
.hero h1 { color: #fff; }
.hero p { color: rgb(255 255 255 / 88%); max-width: 36em; }
.hero .hero-sun { position: absolute; right: 6%; top: 18px; width: 110px; height: 110px; border-radius: 50%; background: var(--sun); opacity: .9; }
.hero .waves { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 56px; }
.hero-inner { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; }
.hero-search { display: flex; gap: 8px; margin-top: 14px; max-width: 620px; }
.hero-search input { border-radius: 999px; border: 0; padding-left: 18px; }
.hero-search .btn { flex: none; }

.sections { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: -64px; position: relative; }
.section-card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px; min-height: 160px;
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none; border-top: 6px solid var(--t-dot);
}
.section-card .art { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--t-soft); color: var(--t); }
.section-card .art .icon { width: 30px; height: 30px; }
.section-card h2 { margin: 6px 0 0; font-size: 1.3rem; }
.section-card .count { color: var(--t); font-weight: 600; font-size: .9rem; }
.section-card p { color: var(--ink-2); font-size: .92rem; margin: 0; }

.block-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.block-title h2 { margin: 0; }
.block-title a { font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.profile-cta { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--camp-soft); }
.profile-cta p { margin: 0; color: var(--ink-2); }
.footnote { margin: 32px 0 0; font-size: .85rem; color: var(--ink-2); text-align: center; }

/* ---------- Listing cards ---------- */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.opp-card {
  position: relative; display: flex; gap: 8px; height: 100%;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  border-left: 6px solid var(--t-dot);
}
.opp-link { flex: 1; min-width: 0; padding: 14px 4px 14px 14px; color: var(--ink); text-decoration: none; display: flex; flex-direction: column; gap: 6px; }
.opp-link h3 { margin: 0; }
.opp-card .org { color: var(--ink-2); font-size: .9rem; margin: 0; }
.opp-card .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .88rem; color: var(--ink-2); margin: 0; }
.opp-card .meta span { display: inline-flex; align-items: center; gap: 4px; }
.opp-card .meta .icon { width: 16px; height: 16px; }
.opp-card .bottom { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; padding-top: 4px; }
.price { font-weight: 600; color: var(--ink); }
.price.free { color: var(--vol); }
.opp-card .side { padding: 10px 10px 0 0; }
.reasons { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px; }
.reasons li { font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: var(--sea-soft); color: var(--sea-deep); }

.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 12px; overflow-x: auto; padding: 2px 2px 10px; list-style: none; margin: 0; scroll-snap-type: x mandatory; }
.scroller > li { scroll-snap-align: start; }
@media (min-width: 900px) { .scroller { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; } }

/* ---------- Search ---------- */
.search-layout { display: grid; gap: 20px; grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.search-layout.narrow { grid-template-columns: minmax(0, 1fr); }
.filters { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; position: sticky; top: 72px; max-height: calc(100dvh - 160px); overflow: auto; }
.filters h2 { font-size: 1.1rem; }
.filters fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.filters legend, .filters .label { font-size: .875rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.filters .chips { flex-wrap: wrap; overflow: visible; }
.filters .chip { min-height: 44px; padding: 0 12px; font-size: .88rem; }
.filters .two { grid-template-columns: 1fr; gap: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; }
.type-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.type-tabs .chip[aria-pressed="true"].t-campamento { background: var(--camp); }
.type-tabs .chip[aria-pressed="true"].t-voluntariado { background: var(--vol); }
.type-tabs .chip[aria-pressed="true"].t-empleo { background: var(--emp); }
.search-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.search-bar .search { flex: 1; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.results-head select { width: auto; }
.results-head p { margin: 0; font-weight: 600; }

/* ---------- Detail ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 600; text-decoration: none; }
.detail { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.detail-head { background: var(--t-soft); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; border-top: 6px solid var(--t-dot); }
.detail-head .org { color: var(--ink-2); margin: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 0 0 16px; }
.facts div { background: var(--surface); border-radius: var(--radius-sm); padding: 12px; box-shadow: var(--shadow); }
.facts dt { font-size: .8rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.facts dd small { display: block; font-weight: 400; color: var(--ink-2); }
.bullets { margin: 0 0 16px; padding-left: 20px; }
.bullets li { margin-bottom: 4px; }
.action-panel { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 10px; }
.action-panel .btn { width: 100%; }
.action-row { display: flex; gap: 8px; }
.action-row .btn { flex: 1; }
.mini-map svg { width: 100%; height: auto; display: block; }
.demo-note { font-size: .85rem; color: var(--ink-2); }

/* ---------- Map ---------- */
.map-card { padding: 8px; }
.island { width: 100%; height: auto; display: block; touch-action: manipulation; }
.island .sea { fill: #CFEAF0; }
.island .land { fill: #F6E7CC; stroke: #D9C29A; stroke-width: 1.5; }
.island .town { cursor: pointer; }
.island .town .hit { fill: transparent; }
.island .town .dot { fill: var(--sea); stroke: #fff; stroke-width: 2; }
.island .town.selected .dot { fill: var(--camp-dot); }
.island .town text { font: 600 13px var(--font); fill: #fff; pointer-events: none; }
.island .home-ring { fill: none; stroke: var(--heart); stroke-width: 3; stroke-dasharray: 5 4; }
.island .pin { fill: var(--heart); }
.island .label { font: 600 14px var(--font); fill: var(--ink); paint-order: stroke; stroke: #F6E7CC; stroke-width: 4px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .85rem; color: var(--ink-2); margin: 8px 4px 0; }
.town-groups { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.town-groups h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.town-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.town-list .chip b { color: var(--sea); }
.town-list .chip[aria-pressed="true"] b { color: var(--sun); }

/* ---------- Mis cosas ---------- */
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { display: flex; gap: 14px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.agenda li:last-child { border-bottom: 0; }
.agenda .date { flex: none; width: 56px; text-align: center; border-radius: 12px; background: var(--sea-soft); color: var(--sea-deep); padding: 4px 0; font-weight: 600; line-height: 1.1; }
.agenda .date b { display: block; font-size: 1.3rem; }
.agenda a { font-weight: 600; text-decoration: none; color: var(--ink); min-height: 44px; display: inline-flex; align-items: center; }
.board { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: start; }
.mine-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.mine-aside h2 { margin-top: 6px; }
.lane { background: var(--surface-2); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.lane h3 { display: flex; justify-content: space-between; font-size: .95rem; }
.lane ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.track-card { background: var(--surface); border-radius: var(--radius-sm); padding: 12px; box-shadow: var(--shadow); border-left: 5px solid var(--t-dot); }
.track-card a { font-weight: 600; color: var(--ink); text-decoration: none; display: block; min-height: 44px; }
.track-card p { font-size: .85rem; color: var(--ink-2); margin: 0 0 6px; }
.track-card select { margin-top: 4px; }
.track-card .note { font-size: .88rem; font-style: italic; color: var(--ink); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.seg button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Profile and forms ---------- */
.profile-form { max-width: 720px; }
.profile-form fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.profile-form legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.errors { background: #F9E1DE; color: var(--bad); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; }
.errors ul { margin: 4px 0 0; padding-left: 20px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 64px; font-weight: 600; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--sun); color: var(--ink); display: grid; place-items: center; font-size: 1.6rem; font-weight: 600; flex: none; }
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.danger-zone { margin-top: 28px; }
dialog.sheet h2 { margin-top: 0; }
.install-tip { display: flex; gap: 10px; align-items: center; background: var(--camp-soft); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; }
.install-tip p { margin: 0; flex: 1; }

/* ---------- Empty states ---------- */
.empty-state { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-state .btn { margin-top: 8px; }

/* ---------- Layout breakpoints ---------- */
@media (max-width: 899px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .action-panel { position: static; }
  .mine-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .sections { grid-template-columns: minmax(0, 1fr); }
  .section-card { min-height: 0; display: grid; grid-template-columns: 52px 1fr; column-gap: 14px; }
  .section-card .art { grid-row: span 3; }
  .section-card h2 { margin: 0; }
  .hero .hero-sun { display: none; }
  .scroller { grid-auto-columns: 85%; }
}
label.chip { cursor: pointer; }
label.chip input { width: 18px; height: 18px; }
label.chip:has(input:checked) { background: var(--ink); color: #fff; border-color: transparent; }
label.chip:has(input:focus-visible) { outline: 3px solid var(--sun); outline-offset: 2px; }
.install-tip { margin: 8px calc(16px + var(--safe-right)) 0 calc(16px + var(--safe-left)); }
a.chip { text-decoration: none; }
.island .label.big { font-size: 30px; stroke-width: 6px; }
.search-layout.narrow .filters { position: static; max-height: none; overflow: visible; }
