/* Leinøra fuglestasjon
   Enkel stil: banner øverst, menylinje, hvitt innholdsfelt. Farger fra logoen. */

:root {
  --bg: #e9e7df;
  --side: #ffffff;
  --tekst: #222;
  --tekst-2: #555;
  --tekst-3: #777;
  --linje: #d6d3c8;
  --gronn: #2f5d50;
  --gronn-lys: #e6eee8;
  --natt: #1d3a52;
  --gul: #d8b41f;
  --soyle: #4b7f6c;
  --font: "Open Sans", Arial, Helvetica, sans-serif;
  --font-tittel: Georgia, "Times New Roman", serif;
  --maks: 1060px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--tekst); font: 16px/1.6 var(--font); }
img { max-width: 100%; display: block; }
a { color: var(--gronn); }
a:hover { color: #1b3a31; }
h1, h2, h3 { font-family: var(--font-tittel); font-weight: normal; line-height: 1.25; margin: 0 0 .5em; color: #1b2f28; }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; margin-top: 1.4em; }
h3 { font-size: 1.15rem; }
h2:first-child, h3:first-child { margin-top: 0; }
p { margin: 0 0 1em; }

.beholder { max-width: var(--maks); margin: 0 auto; padding: 0 16px; }

/* ---------- Topp ---------- */
.banner { background: #556 center 60% / cover no-repeat; }
.banner .beholder { min-height: 170px; display: flex; align-items: center; }
.logo { display: flex; align-items: center; gap: 16px; color: #fff; text-decoration: none; }
.logo:hover { color: #fff; }
.logo img { width: 104px; height: 104px; border-radius: 50%; background: #fff; border: 3px solid #fff; }
.logo .navn { font-family: var(--font-tittel); font-size: 2.1rem; line-height: 1.1; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.logo small { display: block; font-family: var(--font); font-size: .95rem; margin-top: 6px; }

.menylinje { background: var(--gronn); border-bottom: 3px solid var(--gul); position: relative; z-index: 50; }
.meny { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.meny > li { position: relative; }
.meny a, .meny button {
  display: block; color: #fff; text-decoration: none; background: none; border: 0;
  font: inherit; font-size: .98rem; padding: 11px 16px; cursor: pointer;
}
.meny > li > a:hover, .meny > li > button:hover, .meny > li.aktiv > a, .meny > li.aktiv > button { background: rgba(0,0,0,.18); }
.meny button::after { content: " ▾"; font-size: .8em; }
.undermeny { display: none; position: absolute; top: 100%; left: 0; min-width: 200px; list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--linje); }
.undermeny a { color: var(--tekst); padding: 8px 14px; border-bottom: 1px solid #eee; }
.undermeny a:hover, .undermeny a[aria-current="page"] { background: var(--gronn-lys); color: var(--gronn); }
.meny > li:hover .undermeny, .meny > li:focus-within .undermeny, .meny > li.apen .undermeny { display: block; }
.menyknapp { display: none; background: none; border: 0; color: #fff; font: inherit; padding: 11px 0; cursor: pointer; }

@media (max-width: 760px) {
  .banner .beholder { min-height: 120px; }
  .logo img { width: 64px; height: 64px; }
  .logo .navn { font-size: 1.45rem; }
  .logo small { font-size: .82rem; }
  .menyknapp { display: block; }
  .meny { display: none; flex-direction: column; padding-bottom: 8px; }
  .meny.apen { display: flex; }
  .undermeny { position: static; display: block; background: transparent; border: 0; padding-left: 14px; }
  .undermeny a { color: #e4ece7; border: 0; padding: 5px 14px; }
  .undermeny a:hover, .undermeny a[aria-current="page"] { background: rgba(0,0,0,.18); color: #fff; }
  .meny button { cursor: default; font-weight: 600; padding-bottom: 2px; }
  .meny button::after { content: ""; }
}

/* ---------- Innhold ---------- */
.side { max-width: var(--maks); margin: 20px auto 0; padding: 28px 32px 40px; background: var(--side); border: 1px solid var(--linje); }
@media (max-width: 760px) { .side { margin-top: 0; padding: 20px 16px 32px; border-left: 0; border-right: 0; } }
.ingress { color: var(--tekst-2); font-size: 1.05rem; max-width: 720px; }

.forside { display: grid; grid-template-columns: 1fr 290px; gap: 36px; }
@media (max-width: 860px) { .forside { grid-template-columns: 1fr; } }
.to-kol { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 800px) { .to-kol { grid-template-columns: 1fr; } }

/* Innlegg (nyheter, høydepunkter) */
.innlegg { padding-bottom: 22px; margin-bottom: 24px; border-bottom: 1px solid var(--linje); }
.innlegg:last-child { border-bottom: 0; }
.innlegg h2, .innlegg h3 { margin: 0 0 2px; }
.innlegg .dato { color: var(--tekst-3); font-size: .88rem; margin-bottom: 10px; }
.innlegg img { margin: 0 0 12px; max-height: 460px; width: auto; border: 1px solid var(--linje); }
.innlegg.med-bilde { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.innlegg.med-bilde img { width: 220px; height: 165px; object-fit: cover; margin: 0; }
@media (max-width: 560px) { .innlegg.med-bilde { grid-template-columns: 1fr; } .innlegg.med-bilde img { width: 100%; height: auto; } }

/* Sidekolonne */
.sideboks { border: 1px solid var(--linje); background: #faf9f5; padding: 14px 16px; margin-bottom: 18px; font-size: .94rem; }
.sideboks h3 { font-size: 1.05rem; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--gul); }
.sideboks p:last-child, .sideboks ul:last-child { margin-bottom: 0; }
.sideboks ul { margin: 0; padding-left: 18px; }
.minibilder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.minibilder img { aspect-ratio: 1; object-fit: cover; width: 100%; }

/* Gamle kort (søk) – nå flate */
.rutenett { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.kort { border: 1px solid var(--linje); background: #fff; }
.kort img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.kort .kropp { padding: 10px 12px 12px; font-size: .94rem; }
.kort h3 { margin-bottom: 2px; }
.kort .meta, .meta { color: var(--tekst-3); font-size: .88rem; }
.kort p { margin: 4px 0 0; }

.boks { border: 1px solid var(--linje); background: #faf9f5; padding: 14px 18px; }
.latin { font-style: italic; color: var(--tekst-2); }
.merkelapp { font-size: .8rem; color: var(--gronn); border: 1px solid #b9cfc3; padding: 0 5px; white-space: nowrap; }
.varsel { background: #fff7d9; border: 1px solid #e3cf86; padding: 8px 12px; font-size: .94rem; margin: 0 0 18px; }
.kilde { color: var(--tekst-3); font-size: .88rem; }
.tom { color: var(--tekst-3); font-style: italic; }
.knapp { display: inline-block; background: var(--gronn); color: #fff; text-decoration: none; padding: 7px 14px; border: 0; font: inherit; cursor: pointer; }
.knapp:hover { color: #fff; background: #244a3f; }

/* ---------- Siste dag ---------- */
.dag p { margin: 0 0 8px; }
.dag .obs { color: var(--tekst-3); font-size: .85rem; }

/* ---------- Tabeller og søk ---------- */
.filterrad { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.filterrad input[type="search"], .filterrad select { font: inherit; padding: 6px 10px; border: 1px solid #b9b6aa; background: #fff; }
.filterrad input[type="search"] { flex: 1 1 260px; max-width: 420px; }
.filterrad .antall { color: var(--tekst-3); font-size: .9rem; }

.tabell-ramme { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid #e4e1d8; vertical-align: top; }
th { background: var(--gronn-lys); font-weight: 600; white-space: nowrap; border-bottom: 1px solid #c7d6cd; }
th button { all: unset; cursor: pointer; }
th button:hover { text-decoration: underline; }
th[aria-sort="ascending"] button::after { content: " ▲"; font-size: .7em; }
th[aria-sort="descending"] button::after { content: " ▼"; font-size: .7em; }
td.tall, th.tall { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: #faf9f5; }

/* ---------- Diagram ---------- */
.diagram { border: 1px solid var(--linje); padding: 14px 16px; }
.diagram h3 { margin-bottom: 0; }
.diagram .under { color: var(--tekst-3); font-size: .85rem; margin-bottom: 10px; }
.soyler { display: flex; align-items: flex-end; gap: 8px; height: 200px; border-bottom: 1px solid #999; padding-top: 20px; }
.soyle { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.soyle .fyll { width: 100%; max-width: 44px; background: var(--soyle); min-height: 1px; }
.soyle .verdi { font-size: .78rem; color: var(--tekst-2); margin-bottom: 3px; }
.akse { display: flex; gap: 8px; margin-top: 4px; }
.akse span { flex: 1; text-align: center; font-size: .78rem; color: var(--tekst-3); }
.liggende { display: grid; grid-template-columns: minmax(100px, 140px) 1fr auto; gap: 4px 10px; align-items: center; font-size: .9rem; }
.liggende .spor { height: 12px; }
.liggende .fyll { height: 100%; background: var(--soyle); min-width: 1px; }
.liggende .v { font-variant-numeric: tabular-nums; color: var(--tekst-2); text-align: right; }

/* ---------- Galleri ---------- */
.galleri { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.galleri figure { margin: 0; cursor: zoom-in; }
.galleri img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border: 1px solid var(--linje); }
.galleri figure:hover img { opacity: .88; }
.galleri figcaption { font-size: .86rem; margin-top: 4px; line-height: 1.35; }
.galleri figcaption small { display: block; color: var(--tekst-3); }
.fane-rad { margin-bottom: 16px; font-size: .95rem; line-height: 2; }
.fane-rad button { all: unset; cursor: pointer; color: var(--gronn); text-decoration: underline; margin-right: 4px; }
.fane-rad button + button::before { content: "|"; color: #bbb; margin-right: 8px; text-decoration: none; display: inline-block; }
.fane-rad button[aria-pressed="true"] { font-weight: 700; text-decoration: none; color: var(--tekst); }

.lysboks { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 100; display: none; align-items: center; justify-content: center; flex-direction: column; padding: 16px; }
.lysboks.apen { display: flex; }
.lysboks img { max-height: 84vh; max-width: 100%; }
.lysboks p { color: #eee; margin: 10px 0 0; text-align: center; }
.lysboks button { position: absolute; background: none; color: #fff; border: 0; font-size: 2.2rem; width: 48px; height: 48px; cursor: pointer; }
.lysboks .lukk { top: 10px; right: 10px; }
.lysboks .forrige { left: 6px; top: 50%; }
.lysboks .neste { right: 6px; top: 50%; }

/* ---------- Kart ---------- */
#kart { height: 460px; border: 1px solid var(--linje); z-index: 1; }

/* ---------- Tekst fra admin ---------- */
.prosa { max-width: 720px; }
.prosa img { margin: 1em 0; }
.prosa ul { padding-left: 22px; }
.prosa li { margin-bottom: 4px; }

/* ---------- Sjeldne arter ---------- */
.sjeldenliste { list-style: none; padding: 0; margin: 0; }
.sjeldenliste li { padding: 8px 0; border-bottom: 1px solid #e4e1d8; }
.sjeldenliste .funn { font-size: .9rem; color: var(--tekst-2); }

/* ---------- Ringmerkingsåret ---------- */
.aret { position: relative; height: 34px; background: #eee; margin-top: 30px; border: 1px solid #ccc; }
.periode { position: absolute; top: 0; bottom: 0; border-right: 1px solid #fff; }
.periode.alle { background: var(--soyle); }
.periode.foring { background: var(--gul); }
.periode.stengt { background: repeating-linear-gradient(135deg, #ccc 0 5px, #eee 5px 10px); }
.idag { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: #000; }
.idag span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: .78rem; white-space: nowrap; }
.aret-akse { display: grid; grid-template-columns: repeat(12, 1fr); margin-top: 4px; font-size: .78rem; color: var(--tekst-3); }
.aret-akse span { text-align: center; }
.aret-forklaring { list-style: none; padding: 0; margin: 16px 0 0; font-size: .93rem; }
.aret-forklaring li { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.aret-forklaring i.periode { position: static; display: inline-block; flex: none; width: 22px; height: 12px; border: 1px solid #bbb; }

/* ---------- Bunn ---------- */
.bunn { max-width: var(--maks); margin: 0 auto 30px; padding: 16px 32px; background: var(--natt); color: #d5dee4; font-size: .88rem; }
.bunn a { color: #fff; }
.bunn p { margin: 0 0 4px; }
@media (max-width: 760px) { .bunn { margin-bottom: 0; padding: 16px; } }

.skjult { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.foto { color: var(--tekst-3); font-size: .8rem; margin: 2px 0 10px; }
.innlegg.med-bilde .foto { margin-bottom: 0; }
.merkedag { padding: 10px 0; border-bottom: 1px solid #e4e1d8; }
.merkedag:last-child { border-bottom: 0; }
.dag .sjelden { color: #b3261e; }
.dag .uvanlig { font-weight: 600; }
.dag .forklaring { color: var(--tekst-3); font-size: .85rem; }

/* Artsfarger i statistikken */
.stabel { width: 100%; max-width: 44px; display: flex; flex-direction: column-reverse; }
.stabel .del { min-height: 1px; border-top: 2px solid #fff; }
.stabel .del:last-child { border-top: 0; }
.soyle:hover .del { opacity: .85; }
.fargeforklaring { list-style: none; padding: 0; margin: 6px 0 4px; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: .82rem; color: var(--tekst-2); }
.fargeforklaring i, .artsprikk { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: baseline; }
.artsprikk { margin-right: 7px; }
.liggende .fyll { border-radius: 0; }

/* Grafer (utvidet statistikk og artssider) */
.graf { position: relative; height: 240px; }
.grafrutenett { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grafrutenett.to { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-bottom: 14px; }
.diagram + .diagram { margin-top: 14px; }
.grafrutenett .diagram + .diagram { margin-top: 0; }
.filterrad label { font-size: .92rem; }
.artsbilde img { max-height: 300px; width: auto; border: 1px solid var(--linje); }
.arvelger { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: .88rem; margin: 2px 0 8px; color: var(--tekst-2); }
.arvelger label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--tekst); }
.arvelger i { display: inline-block; width: 10px; height: 10px; }
.sjeldenliste li.med-foto { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; }
.aofoto { margin: 0; }
.aofoto img { width: 120px; height: 90px; object-fit: cover; border: 1px solid var(--linje); cursor: zoom-in; }
.aofoto figcaption { font-size: .72rem; color: var(--tekst-3); line-height: 1.3; margin-top: 2px; }
@media (max-width: 560px) { .sjeldenliste li.med-foto { grid-template-columns: 90px 1fr; } .aofoto img { width: 90px; height: 68px; } }

/* Galleri uten beskjæring: rader med lik høyde, bredden følger bildet */
.galleri.hele { display: flex; flex-wrap: wrap; gap: 10px; }
.galleri.hele figure { flex: 1 1 200px; min-width: 0; }
.galleri.hele img { width: 100%; height: auto; aspect-ratio: auto; object-fit: contain; background: #f4f3ee; }
.galleri.hele .rad-slutt { flex-grow: 6; flex-basis: 0; }

/* Små bilder på merkedager */
.dagbilder { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 8px; }
.dagbilder figure { margin: 0; max-width: 130px; }
.dagbilder img { height: 80px; width: auto; max-width: 130px; object-fit: contain; border: 1px solid var(--linje); cursor: zoom-in; background: #f4f3ee; }
.dagbilder figcaption { font-size: .7rem; line-height: 1.3; color: var(--tekst-3); margin-top: 2px; }
.sideboks .dagbilder img { height: 60px; max-width: 90px; }
.sideboks .dagbilder figure { max-width: 90px; }

/* Høydepunkter: sjeldne ringmerkede arter */
.ringkort-rutenett { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 10px; }
.ringkort { margin: 0; }
.ringkort img { width: 100%; height: 170px; object-fit: contain; background: #f4f3ee; border: 1px solid var(--linje); cursor: zoom-in; }
.ringkort figcaption { font-size: .88rem; line-height: 1.45; margin-top: 4px; }
.ringkort .foto { margin: 0; }
.galleri.hele figcaption { font-size: .84rem; }
.galleri.hele figcaption small { display: block; }

/* Én flis per art (artsgalleri, galleri-høydepunkter) */
.artsfliser { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.artsflis { margin: 0; cursor: zoom-in; }
.artsflis img { width: 100%; height: 150px; object-fit: contain; background: #f4f3ee; border: 1px solid var(--linje); }
.artsflis:hover img { opacity: .88; }
.artsflis figcaption { font-size: .88rem; line-height: 1.35; margin-top: 4px; }
.artsflis small { display: block; color: var(--tekst-3); font-size: .74rem; }
/* Fliser som følger bildets format */
.artsfliser { display: flex; flex-wrap: wrap; gap: 12px; }
.artsfliser .artsflis { flex: 1 1 180px; min-width: 0; }
.artsfliser .artsflis img { height: auto; aspect-ratio: auto; }
.artsfliser .rad-slutt { flex-grow: 6; flex-basis: 0; }
.artsfliser .artsflis { min-width: 110px; }
.artsflis figcaption, .galleri.hele figcaption { overflow-wrap: anywhere; }
/* Fliser: lik høyde (150 px), bredde etter bildet */
.artsfliser .artsflis { flex: 0 0 auto; width: 200px; min-width: 110px; }
.artsfliser .artsflis img { height: 150px; width: 100%; object-fit: cover; }
.bryter { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; cursor: pointer; }

/* Gjenfunnskart */
.kartforklaring { list-style: none; padding: 0; margin: 10px 0 2px; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .9rem; }
.kartforklaring i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #999; margin-right: 6px; vertical-align: -1px; }
.kartforklaring i.hjem { background: #d8b41f; box-shadow: 0 0 0 2px #222; }
.gjenfunn-popup table { font-size: .82rem; margin-top: 6px; }
.gjenfunn-popup th, .gjenfunn-popup td { padding: 2px 6px 2px 0; border: 0; background: none; white-space: normal; }
.gjenfunn-popup th { color: #666; font-weight: 600; }
body[data-side="gjenfunn"] #tabell tbody tr { cursor: pointer; }
