/* ==========================================================================
   flag-db.css – the flag database (flagg-database.html)
   1. The page and the legend
   2. The packs and their flags (with the count on each)
   3. The country window
   4. Phones
   The colours come from css/flag-theme.css (loaded after this file).
   ========================================================================== */

/* ---------- 1. The page and the legend ---------- */
/* the top: the same look as the flags page ("Piña" link, title, EN / ES / NO) */
.top { display: flex; align-items: center; gap: 16px; padding-top: 18px; padding-bottom: 6px; }
.top .mask { flex: 1; min-width: 0; }
.top h1 { margin: 0; font-size: 1.5rem; font-weight: 700; color: var(--dark); text-transform: uppercase; letter-spacing: .03em; }
.home { display: inline-flex; align-items: center; gap: 8px; color: var(--dark); font-weight: 600; font-size: .9rem; text-decoration: none; }
.home img { width: 28px; height: 28px; }
.home:hover { color: var(--primary); }
.lang { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 99px; background: #fff; }
.lang button { padding: 4px 10px; border: 0; border-radius: 99px; background: none; color: #999; font: inherit; font-size: .72rem; font-weight: 600; letter-spacing: .05em; cursor: pointer; }
.lang button:hover { color: var(--dark); }
.lang button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.db { padding-bottom: 60px; }
.db-intro { max-width: 720px; margin: 6px 0 14px; color: var(--text); }
.db-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 10px; padding: 0; list-style: none; font-size: .85rem; color: var(--text); }
.db-legend li { display: flex; align-items: center; gap: 8px; }
.db-legend .count { position: static; }
.db-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 26px; }
.db-links a { padding: 8px 16px; border-radius: 99px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: var(--dark); font-weight: 600; font-size: .9rem; text-decoration: none; }
.db-links a:hover { box-shadow: inset 0 0 0 2px var(--primary); }

/* ---------- 2. The packs ---------- */
.db-pack { margin: 0 0 34px; }
.db-pack h2 { display: flex; flex-direction: column; margin: 0 0 12px; color: var(--dark); font-size: 1.25rem; }
.db-pack h2 small { color: var(--play); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.db-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.db-flag { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; padding: 0; border: 0; background: none; font: inherit; text-align: center; cursor: pointer; }
.db-pic { position: relative; display: block; border-radius: 8px; box-shadow: 0 4px 12px rgba(74, 68, 88, .16); transition: transform .2s ease, box-shadow .2s ease; }
.db-pic img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; }
.db-flag:hover .db-pic, .db-flag:focus-visible .db-pic { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(74, 68, 88, .22); }
.db-flag:focus-visible { outline: none; }
.db-flag:focus-visible .db-pic { outline: 3px solid var(--dark); outline-offset: 3px; }
.db-name { color: var(--dark); font-size: .85rem; font-weight: 600; line-height: 1.25; }
/* the count: "12 / 26", "26 ✓" or "–" */
.count { position: absolute; right: -6px; top: -8px; padding: 2px 8px; border-radius: 99px; font-size: .72rem; font-weight: 700; line-height: 1.5; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.count.part { background: #fbeee6; color: #8a4f35; }
.count.all { background: #e3f0e7; color: #3b6c4c; }
.count.none { background: #f1ecee; color: #9a93a3; }

/* ---------- the link to the credits page ---------- */
.db-credits { margin: 10px 0 0; }
.db-credits a, .db-credit-link { color: var(--primary); font-size: .9rem; font-weight: 600; text-decoration: none; }
.db-credits a:hover, .db-credit-link:hover { text-decoration: underline; }
.db-credit-link { display: inline-block; margin-top: 18px; }
.db-credit-link[hidden], .db-report[hidden] { display: none; }
/* uncertain flag: a ? in the corner (tap it for the explanation); also used in the legend */
.db-unsure { position: absolute; top: -7px; right: -7px; display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: #f4b740; color: #3d3747; font: 700 .8rem/1 inherit; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); cursor: help; }
.db-unsure.static { position: static; display: inline-flex; vertical-align: middle; cursor: default; }
.db-unsure:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.db-unsure-tip { position: fixed; z-index: 420; max-width: 260px; padding: 9px 12px; border-radius: 10px; background: #3d3747; color: #fff; font-size: .8rem; line-height: 1.4; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); pointer-events: none; }
.cr-unsure { color: #8a5a00; font-style: normal; font-size: .78rem; }
.db-report { display: block; margin-top: 8px; color: var(--primary); font-size: .9rem; font-weight: 600; text-decoration: none; }
.db-report:hover { text-decoration: underline; }
.db-honest { margin: -4px 0 14px; color: #8a8392; font-size: .82rem; }
.cr-note-honest { margin: 0 0 16px; color: #8a8392; font-size: .82rem; }

/* ---------- 3. The country window ---------- */
body.modal-open { overflow: hidden; }
.db-modal { position: fixed; inset: 0; z-index: 400; overflow-y: auto; padding: 24px 16px; background: rgba(61, 55, 71, .45); animation: dbFade .25s ease; }
.db-modal[hidden] { display: none; }
@keyframes dbFade { from { opacity: 0; } }
.db-card { position: relative; width: min(900px, 100%); margin: 0 auto; padding: 24px; border-radius: 22px; background: #fffdfb; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); animation: dbUp .35s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes dbUp { from { transform: translateY(30px); opacity: 0; } }
.db-close { position: sticky; top: 0; float: right; z-index: 2; width: 40px; height: 40px; margin: -8px -8px 0 0; border: 0; border-radius: 50%; background: #fff; color: var(--dark); font-size: 1.6rem; line-height: 1; box-shadow: 0 3px 10px rgba(0, 0, 0, .15); cursor: pointer; }
.db-head { display: flex; align-items: center; gap: 20px; margin: 0 0 14px; }
.db-head img { flex: none; width: min(240px, 42%); height: auto; border-radius: 10px; box-shadow: 0 8px 22px rgba(74, 68, 88, .22); }
.db-head h2 { margin: 0 0 4px; color: var(--dark); font-size: 1.6rem; }
.db-sub { margin: 0; color: var(--text); }
.db-status { margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; background: #f6f0ed; color: var(--dark); font-size: .9rem; }
.db-status[hidden], .db-empty[hidden] { display: none; }
.db-empty { color: var(--text); }
.db-regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px 14px; margin: 0; padding: 0; list-style: none; }
.db-regions li { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.db-rpic { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 2; border-radius: 6px; background: #fff; }
.db-regions .has .db-rpic { box-shadow: 0 3px 10px rgba(74, 68, 88, .16); }
.db-rpic img { max-width: 100%; max-height: 100%; border-radius: 4px; }
.db-regions .missing .db-rpic { background: repeating-linear-gradient(135deg, #f6f0ed 0 8px, #f1e9e5 8px 16px); box-shadow: inset 0 0 0 2px #e6dbd5; }
.db-regions .nope .db-rpic { background: #f7f5f6; box-shadow: inset 0 0 0 1px #ece7ea; }
.db-mark { color: #b7a9a2; font-size: 1.6rem; font-weight: 700; }
.db-rname { color: var(--dark); font-size: .82rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.db-note { color: #9a93a3; font-size: .75rem; }


/* ---------- 3b. The credits page (flagg-kreditering.html) ---------- */
.cr-block { margin: 0 0 30px; }
.cr-block h2 { margin: 0 0 8px; color: var(--dark); font-size: 1.2rem; }
.cr-note { margin: 0 0 16px; color: var(--text); font-size: .9rem; }
.cr-other { margin: 0; padding-left: 18px; color: var(--text); font-size: .9rem; line-height: 1.6; }
.cr-other strong { color: var(--dark); }
.cr-country { margin: 0 0 18px; padding: 14px 16px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); scroll-margin-top: 16px; }
.cr-country.flash { animation: crFlash 1.6s ease; }
@keyframes crFlash { 30% { box-shadow: inset 0 0 0 3px var(--learn-deep, #e9a27f); } }
.cr-country h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; color: var(--dark); font-size: 1rem; }
.cr-country h3 img { width: 36px; height: auto; border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.cr-country h3 small { margin-left: auto; color: #9a93a3; font-size: .75rem; font-weight: 600; }
.cr-list { margin: 0 0 8px; padding-left: 18px; color: var(--text); font-size: .82rem; line-height: 1.55; overflow-wrap: anywhere; }
.cr-list strong { color: var(--dark); }
.cr-free { margin: 0; color: var(--text); font-size: .8rem; line-height: 1.6; }
.cr-free strong { color: var(--dark); }
.credits a { color: var(--primary); }

/* ---------- 3c. ‹ › the country before / after ---------- */
/* computer: one on each side of the window; phone: a bar at the bottom (see 4.) */
.db-step button { position: fixed; top: 50%; z-index: 410; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; padding: 10px 6px; border: 0; border-radius: 16px; background: rgba(255, 253, 251, .94); color: var(--dark); font: inherit; font-size: .72rem; font-weight: 600; line-height: 1.2; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); cursor: pointer; transform: translateY(-50%); transition: transform .15s, background .15s; }
.db-step button:hover { background: #fff; transform: translateY(-50%) scale(1.05); }
.db-step button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.db-prev { left: max(12px, calc(50% - 450px - 112px)); }
.db-next { right: max(12px, calc(50% - 450px - 112px)); }
.db-step img { width: 48px; height: auto; border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.db-arrow { font-size: 1.8rem; line-height: .8; color: var(--primary); }
.db-step-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-next .db-step-name { order: 2; }
.db-next .db-arrow { order: -1; }
.db-card.from-right { animation: dbFromRight .3s ease; }
.db-card.from-left { animation: dbFromLeft .3s ease; }
@keyframes dbFromRight { from { opacity: .2; transform: translateX(40px); } }
@keyframes dbFromLeft { from { opacity: .2; transform: translateX(-40px); } }
/* not room on the sides: a bar at the bottom instead */
@media (max-width: 1140px) {
	.db-modal { padding-bottom: 96px; }
	.db-step button { top: auto; bottom: 12px; flex-direction: row; gap: 8px; width: auto; max-width: calc(50% - 18px); padding: 8px 12px; border-radius: 99px; transform: none; font-size: .8rem; }
	.db-step button:hover { transform: none; }
	.db-prev { left: 12px; }
	.db-next { right: 12px; }
	.db-next .db-step-name { order: 0; }
	.db-next .db-arrow { order: 2; }
	.db-step img { width: 34px; }
}
@media (prefers-reduced-motion: reduce) { .db-card.from-right, .db-card.from-left { animation: none; } }

/* ---------- 4. Phones ---------- */
@media (max-width: 640px) {
	.top { flex-wrap: wrap; row-gap: 8px; }
	.top .mask { order: 3; flex-basis: 100%; }
	.top .lang { margin-left: auto; }
	.top h1 { font-size: 1.15rem; }
	.db-grid { grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
	.db-name { font-size: .78rem; }
	.db-modal { padding: 0; }
	.db-card { min-height: 100%; border-radius: 0; padding: 18px 16px 30px; }
	.db-head { flex-direction: column; align-items: flex-start; gap: 12px; }
	.db-head img { width: 70%; }
	.db-regions { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .db-modal, .db-card { animation: none; } }

/* a region found with the 🔍 search (js/flag-search.js): lit up for a moment */
.db-flash { animation: dbFlash 2.4s ease; border-radius: 10px; }
@keyframes dbFlash { 0%, 40% { box-shadow: 0 0 0 3px var(--primary, #e9a27f); background: #fff4ea; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .db-flash { animation: none; box-shadow: 0 0 0 3px var(--primary, #e9a27f); } }

/* 📍 a region on Bit-Map (js/bitmap-link.js): a small pin in the picture's lower right corner */
.db-pin { position: absolute; right: -6px; bottom: -6px; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .22); font-size: .72rem; line-height: 1; text-decoration: none; transition: transform .15s; }
.db-pin:hover { transform: scale(1.15); }
.db-pin:focus-visible { outline: 3px solid var(--primary, #e9a27f); outline-offset: 2px; }
