/* Public base: tokens, reset, typography, layout, tiles, image floats. Loaded first. */

/***********************************************
    Abenteuersuchtberatung Stylesheet
***********************************************/
/* Orange: ff4d06, brown: 553a26, blue: 06afff */
@font-face {
    font-family: 'Gagalin';
    src: url('fonts/gagalin.woff2?v=1') format('woff2'),
         url('fonts/gagalin.woff?v=1') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Color Palette */
    --color-orange: #ff4d06;
    --color-brown: #553a26;
    --color-brown-bg: #504128;
    --color-brown-mid: #624936;
    --color-brown-light: #6f5847;
    --color-brown-dark: #3d2a1a;
    --color-blue: #06afff;
    --color-link: #005a9e;
    --color-nav-link: #7dd4ff;
    --color-bg-primary: #f5f4f2;
    --color-bg-white: #fff;
    --color-bg-orange: #ff9a71;
    --color-bg-sand: #f3eee5;
    --color-text-primary: #3b332d;
    --color-text-muted: #7a6f66;
    --color-border: rgba(31, 23, 18, 0.1);

    /* Design system (fine-tuning): warm espresso instead of black, orange from
       the logo. Brand orange (#ff4d06) reaches only 3.3:1 on white, so text
       and buttons use the darker steps (5.2:1 and 4.7:1). */
    --color-ink: #1f1712;
    --color-espresso: #241a13;
    --color-orange-ink: #c2410c;
    --color-orange-strong: #d63c00;
    --color-orange-deep: #a83200;
    --color-hairline: rgba(31, 23, 18, 0.09);
    --radius-tile: 22px;
    --radius-card: 16px;
    --radius-media: 14px;
    --radius-pill: 999px;
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --tile-padding: clamp(1.5rem, 1rem + 2.5vw, 3.25rem);

    /* Typography — system UI: SF Pro (Apple), Segoe UI (Windows), Roboto
       (Android). No webfont file, no CSP change. */
    --font-family-base: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-family-heading: 'Gagalin', sans-serif;
    --font-size-base: clamp(16px, 0.95rem + 0.2vw, 18px);
    --line-height-base: 1.6;
    --line-height-heading: 1.2;

    /* Spacing */
    --spacing-xs: 0.25em;
    --spacing-sm: 0.5em;
    --spacing-md: 1em;
    --spacing-lg: 2em;
    --spacing-xl: 3em;

    /* Layout */
    --container-max-width: 1200px;
    --nav-height: 2.75em; /* Admin header/nav (admin-layout.css); public nav: see nav.nav-logo-left-and-menu-right */
    --logo-height: 6em;

    /* Borders & Shadows */
    --border-radius-sm: 3px;
    --border-radius-md: 8px;
    --border-radius-lg: 25px;
    --box-shadow-sm: 0 0 2px 1px rgba(0, 140, 186, 0.5);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.6s ease;
    --transition-slow: 1.0s ease;

    /* Z-index layers */
    --z-modal: 9999;
    --z-nav-dropdown: 1100;
    --z-nav-logo: 1001;
    --z-nav-menu: 1000;

    /* Filters */
    --filter-orange-icon: brightness(0) saturate(100%) invert(40%) sepia(97%) saturate(900%) hue-rotate(345deg) brightness(108%);
}

html {
    scroll-behavior: smooth;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern";
}

ul {
    list-style-type: disc;
    margin: 0;
}

li::marker { color: var(--color-orange); }

/* Running-text lists only (no class); component lists set their own spacing */
.sectionbox :is(ul, ol):not([class]) > li + li { margin-top: 0.25em; }

/* Former "<b><u>Heading:</u></b>" lines: the underline looks like
   a link, so show them as a quiet intermediate line. */
b > u, u > b, strong > u {
    text-decoration: none;
    color: var(--color-ink);
    font-weight: 650;
}

/* Spacing hook injected by md_to_html when a blank line precedes a list */
.list-gap { display: none; }
.list-gap + ul,
.list-gap + ol { margin-top: 1em; }

ul ul {
    list-style-type: circle;
}

table {
    margin-top: 1em;
}

th {
    padding-right: 1em;
    font-weight: normal;
    text-align: left;
}

/* Headings: much more space above than below, so a heading visually
   belongs to its own text (law of proximity).
   Gagalin has capitals only but reserves room for ascenders and
   descenders (~0.6em of empty space), hence line-height 1.2 instead of 1.5.
   Sizes grow fluidly with the width and are capped:
   phone → 1200px → max (body text 17 → 18px): h1 35→38→45, h2 24→29→31.5,
   h3 21→24→25, h4–h6 19→20px. */
h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: var(--line-height-heading);
    text-align: left;
    text-wrap: balance;
    color: var(--color-ink);
}

/* Gagalin (logo font) for h1/h2 only, so the brand stays recognizable; below
   that the calm system sans takes over. Gagalin is wide and bold by nature,
   hence only minimal tracking. */
h1 {
    margin: 0 0 0.35em;
    font-family: var(--font-family-heading);
    font-weight: normal;
    font-size: clamp(2.1em, 1.5em + 1.6vw, 3em);
    letter-spacing: 0.015em;
}

h2 {
    margin: 1.4em 0 0.4em;
    font-family: var(--font-family-heading);
    font-weight: normal;
    font-size: clamp(1.45em, 1.2em + 0.8vw, 1.9em);
    letter-spacing: 0.015em;
}

/* Subtitle right below the page title (e.g. home page): a quiet lead in
   the text font instead of a second poster line. */
h1 + h2 {
    margin-top: -0.1em;
    font-family: var(--font-family-base);
    font-weight: 500;
    font-size: clamp(1.2em, 1.05em + 0.6vw, 1.55em);
    letter-spacing: -0.015em;
    color: var(--color-text-muted);
}

h3 {
    margin: 1.4em 0 0.3em;
    font-family: var(--font-family-base);
    font-weight: 700;
    font-size: clamp(1.2em, 1.1em + 0.35vw, 1.4em);
    letter-spacing: -0.015em;
}

/* h4–h6 share one step; otherwise browser defaults apply (h5/h6
   smaller than body text, huge space below). */
h4,
h5,
h6 {
    margin: 1.5em 0 0.3em;
    font-family: var(--font-family-base);
    font-size: 1.1em;
    font-weight: 650;
    letter-spacing: -0.01em;
}

details > table {
    margin-bottom: 0.5em;
}

/* Content right below a heading moves up to it (p, lists … otherwise have
   margin-top: 1em, which collapses with the small margin-bottom).
   .list-gap: marker from md_to_html before lists with a blank line. */
:is(.sectionbox, .article-body, details) > :is(h1, h2, h3, h4, h5, h6) + :is(p, ul, ol, table, details, blockquote, pre, .image-grid),
:is(.sectionbox, .article-body, details) > :is(h1, h2, h3, h4, h5, h6) + .list-gap + :is(ul, ol),
:is(.sectionbox, .article-body, details) > :is(h1, h2, h3, h4, h5, h6) + :is(.img-float-left, .img-float-right) + p {
    margin-top: 0;
}

/* Heading right below a heading: no big gap */
:is(h1, h2, h3, h4, h5, h6) + :is(h2, h3, h4, h5, h6) { margin-top: 0.3em; }

/* Left-aligned instead of justified: without a fine typesetting engine,
   justification tears holes into the lines (especially in narrow phone columns). */
p {
    margin-top: 1em;
    margin-bottom: 0;
    text-align: left;
    hyphens: auto;
    text-wrap: pretty;
}

/* No max-width/auto margins: when the quote sits next to a float, only the
   lines get shorter; a narrow box would slide below the image. */
.quote {
    margin: 1.2em 0;
    padding: 0 0.5em;
    font-weight: 600;
    font-style: normal;
    font-size: clamp(1.2em, 1.05em + 0.6vw, 1.5em);
    line-height: 1.35;
    letter-spacing: -0.015em;
    color: var(--color-ink);
    text-align: center;
    text-wrap: balance;
    hyphens: manual;
}

a {
    text-decoration: none;
    color: var(--color-orange-ink);
    transition: color var(--transition-fast);
}

a:hover {
    text-decoration: none;
    color: var(--color-orange-deep);
}

/* Links in running text: underline only on hover, with room to the baseline.
   Only in content tiles and only class-less links (Markdown, templates);
   nav, footer and components such as the article list are li > a as well
   and show hover through color, not underline. */
.sectionbox :is(p, li) > a:not([class]):hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Improve keyboard navigation accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-orange);
    outline-offset: 3px;
    border-radius: var(--border-radius-sm);
}

::selection {
    background: rgba(255, 77, 6, 0.18);
    color: var(--color-ink);
}

img {
    width: 100%;
    height: auto;
}

.container {
    display: flex;
    width: 100%;
    max-width: var(--container-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}


/*********************************************
  General Content Formatting
*********************************************/
section {
    width: 100%;
    padding: clamp(2rem, 1.5rem + 1.5vw, 3rem) 0 clamp(2.5rem, 2rem + 2vw, 4rem);
}

section > .container {
    flex-direction: column;
    gap: clamp(0.75rem, 0.5rem + 0.8vw, 1.25rem);
}

.sectionbox {
    display: flow-root;
    padding: var(--tile-padding);
    margin: 0;
    border-radius: var(--radius-tile);
}

/* Images in content tiles: soft radius, one step smaller than the tile */
.sectionbox img,
.flexcont img {
    border-radius: var(--radius-media);
}

/* Prevent first/last child margins from stacking on top of the box's padding */
.sectionbox > *:first-child,
.sectionbox > a > *:first-child {
    margin-top: 0;
}

.sectionbox > *:last-child,
.sectionbox > a > *:last-child {
    margin-bottom: 0;
}


.boxwhite {
    background-color: var(--color-bg-white);
}

.boxorange {
    background-color: var(--color-bg-orange);
}

.boxsandgr {
    background-color: var(--color-bg-sand);
}

.boxbrown {
    background-color: var(--color-espresso);
}

.boxbrown h2 { color: rgba(255,255,255,0.92); margin-top: 0; margin-bottom: 0; }
.boxbrown .geo-subtitle { color: rgba(255,255,255,0.92); margin-top: 0; }

.boxorange a { color: var(--color-orange); }
.boxorange a:hover { color: var(--color-blue); }



.sectionbox > ul,
.sectionbox > a > ul {
    overflow: auto;
}


.contentref a, .contentref a:hover {
    display: flow-root;
    height: 100%;
    width: 100%;
    text-decoration: none;
    color: inherit;
    padding: var(--tile-padding);
}

.contentref a > :first-child { margin-top: 0; }

.sectionbox.contentref { padding: 0; }

/* The whole tile is a link: hover shows that without jumping */
.contentref {
    transition: background-color var(--transition-fast), box-shadow 0.35s var(--ease-out);
}

.contentref:hover {
    box-shadow: 0 1px 2px rgba(31, 23, 18, 0.04), 0 12px 32px -12px rgba(31, 23, 18, 0.18);
}

/* "…mehr" / "zum Bereich …" at the end of a tile as a call to action */
.contentref p > i:last-child,
.contentref p:last-child > i:only-child {
    font-style: normal;
    font-weight: 600;
    color: var(--color-orange-ink);
}

.flexcont > .contentref {
    border-radius: var(--radius-card);
    overflow: hidden;
}

/* Cards in cards: smaller padding than the outer tile */
.flexcont > .contentref > a,
.flexcont > .contentref > a:hover {
    padding: clamp(1.25rem, 1rem + 1vw, 2rem);
}

.flexcont {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
}

/* Mobile (column): height from the content. With flex-basis 0 and the cards'
   overflow: hidden they collapsed to height 0 (min-height: auto does not apply
   with overflow ≠ visible). Desktop: media query below (2 columns). */
.flexcont > div {
    flex: 0 0 auto;
}

.flexcont img {
    width: 100%;
    height: auto;
    display: block;
}


/*********************************************
  Individual / Special Single Content (Images)
*********************************************/

/* Logo float in ASB section — always floating, specific max-width */
.asbindex {
    float: right;
    width: 30%;
    max-width: 200px;
    margin-left: 1.5em;
    margin-bottom: 1em;
    filter: drop-shadow(0 10px 24px rgba(31, 23, 18, 0.18));
}

/* Generic float image utilities — float kicks in at desktop breakpoint */
.img-float-left,
.img-float-right {
    margin: 0.75em 0 1em;
}

/* Book cover (portrait): not full-screen on mobile; desktop: see media query */
.img-float--book {
    display: block;
    max-width: 220px;
}



@media screen and (min-width: 651px) {
    .img-float-left  { float: left;  width: 30%; margin: 0.35em 2em 1em 0; }
    .img-float-right { float: right; width: 30%; margin: 0.35em 0 1em 2em; }
    .img-float--wide { width: 40%; }
    .img-float--book { max-width: 300px; }
    .flexcont { flex-direction: row; flex-wrap: wrap; }
    .flexcont { gap: 1.25rem; }
    .flexcont > div { flex: 1 1 calc(50% - 1.25rem / 2); max-width: calc(50% - 1.25rem / 2); }
}
