/* ---------------------------------------------------------------------------
   Palette. #825935 is the average colour of the masthead photograph and is
   what the nav bar uses; everything branded on the site derives from it so
   the nav, links, tags and footer stay in step.
   --------------------------------------------------------------------------- */
:root {
  --brand: #825935;
  --brand-dark: #6a4729;
  --brand-tint: rgba(130, 89, 53, 0.10);
  --brand-line: rgba(130, 89, 53, 0.30);
  --brand-rule: rgba(130, 89, 53, 0.22);
  --muted: #6b6257;
}

/* ---------------------------------------------------------------------------
   Sarabun.

   One family with real weight/style descriptors, so <strong>, <em> and the
   Bootstrap weight classes resolve to the right file. The previous setup
   declared three separate families (SarabunRegular / SarabunBold /
   SarabunItalic) each marked font-weight: normal, so the browser had no way
   to tell which was bold - and nothing set font-family anyway, so none of it
   was ever applied.

   Browsers only fetch the faces a page actually uses, so listing several
   costs nothing up front. font-display: swap shows fallback text immediately
   instead of leaving it invisible while a ~130KB TTF loads.
   --------------------------------------------------------------------------- */

@font-face {
  font-family: 'Sarabun';
  src: url('/fonts/Sarabun-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sarabun';
  src: url('/fonts/Sarabun-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sarabun';
  src: url('/fonts/Sarabun-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Sarabun';
  src: url('/fonts/Sarabun-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sarabun';
  src: url('/fonts/Sarabun-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sarabun';
  src: url('/fonts/Sarabun-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* Loaded after Bootstrap, so this wins over its default body stack.
   Headings, the nav and form controls all inherit from here. */
body {
  font-family: 'Sarabun', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

ul#index{

    padding-left: 0;
    list-style-type: none;
}


#message {
    height: 10em;
}

/* Nav + masthead fill exactly one screen on load: the wrapper is the viewport
   height and the masthead takes whatever is left under the nav, so there is no
   hard-coded nav height to keep in sync and nothing spills past the fold.
   dvh keeps it honest on mobile, where the address bar changes 100vh. */
.hero-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.masthead {
  /* Full bleed, and takes all remaining height under the nav. */
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Root-relative: the absolute http:// URL was mixed content on an https page. */
  background-image: url('/images/strange.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* The bokeh runs from blown-out white to near-black, so no single text colour
   is readable across it. A radial wash gives the type a consistent dark
   backdrop while leaving the edges of the photograph nearly untouched. */
.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse 65% 55% at 50% 50%,
      rgba(0, 0, 0, 0.62) 0%,
      rgba(0, 0, 0, 0.5) 40%,
      rgba(0, 0, 0, 0.2) 72%,
      rgba(0, 0, 0, 0.06) 100%
    );
  /* Must not swallow clicks on the scroll cue. */
  pointer-events: none;
}

.masthead-inner {
  position: relative;
  z-index: 1;
  padding: 0 20px;
  color: #fff;
}

.masthead-inner h1 {
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6), 0 1px 3px rgba(0, 0, 0, 0.5);
}

.masthead-inner .lead {
  /* Bumped off Bootstrap's 300: thin type over a busy photo is the hardest
     thing to read, and this sits below the large-text contrast threshold. */
  font-weight: 400;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65), 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Scroll cue: the hero fills the screen, so nothing below it is visible on
   load. This hints there is more, and doubles as a jump link to the posts. */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: 96px;
  height: 96px;
  line-height: 96px;
  text-align: center;
  font-size: 56px;
  text-decoration: none;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  /* The X offset has to be repeated in every keyframe below, or the cue
     snaps to the left edge as soon as the animation takes over transform. */
  transform: translateX(-50%);
  animation: scroll-cue-bounce 2.2s ease-in-out infinite;
}

.scroll-cue:link,
.scroll-cue:visited {
  color: #fff;
}

.scroll-cue:hover,
.scroll-cue:focus {
  color: #fff;
  opacity: 0.7;
}

@keyframes scroll-cue-bounce {
  0%,
  25%,
  55%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-11px);
  }
  48% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/* Respect a reduced-motion preference: keep the cue, drop the bounce. */
@media (prefers-reduced-motion: reduce) {
  .scroll-cue {
    animation: none;
  }
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------------------------------------------------------------------------
   Site navigation, mirrored from ikhider.com.

   The bar colour is #825935, the average colour of the masthead image
   (images/strange.jpg), so the nav sits with the photograph rather than
   against it. White on that gives roughly 6:1 contrast.
   --------------------------------------------------------------------------- */

.topnav {
  background-color: var(--brand);
  padding: 20px;
}

/* Clearfix instead of overflow:hidden: hiding overflow here would clip the
   Blog(s) menu, which hangs below the bar. */
.topnav::after {
  content: "";
  display: table;
  clear: both;
}

.topnav a {
  float: left;
  display: block;
  color: #fff;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
}

.topnav a:link,
.topnav a:visited {
  color: #fff;
}

.topnav a:hover {
  background-color: #fff;
  color: #000;
}

.topnav a.active {
  background-color: #000;
  color: #fff;
}

.topnav .icon {
  display: none;
}

/* Blog(s) dropdown. Scoped under .topnav so it cannot collide with
   Bootstrap's own .dropdown, and positioned relative here so the menu is
   anchored to the button rather than to the page. */
.topnav .dropdown {
  float: left;
  position: relative;
  overflow: visible;
}

.topnav .dropdown .dropbtn {
  font-size: 16px;
  border: none;
  outline: none;
  color: #fff;
  padding: 14px 16px;
  background-color: inherit;
  font-family: inherit;
  margin: 0;
  cursor: pointer;
}

.topnav .dropdown:hover .dropbtn {
  background-color: var(--brand-dark);
}

.topnav .dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #fff;
  min-width: 190px;
  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.topnav .dropdown-content a,
.topnav .dropdown-content a:link,
.topnav .dropdown-content a:visited {
  float: none;
  color: #000;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.topnav .dropdown-content a:hover {
  background-color: #000;
  color: #fff;
}

.topnav .dropdown:hover .dropdown-content {
  display: block;
}

@media screen and (max-width: 600px) {
  /* Collapse to the bars icon. The dropdown is a div, so the
     a:not(:first-child) rule does not cover it - hide it explicitly. */
  .topnav a:not(:first-child),
  .topnav .dropdown {
    display: none;
  }

  .topnav a.icon {
    float: right;
    display: block;
  }

  .topnav.responsive {
    position: relative;
  }

  .topnav.responsive a.icon {
    position: absolute;
    right: 0;
    top: 0;
  }

  .topnav.responsive a {
    float: none;
    display: block;
    text-align: left;
  }

  .topnav.responsive .dropdown {
    float: none;
    display: block;
  }

  .topnav.responsive .dropdown .dropbtn {
    display: block;
    width: 100%;
    text-align: left;
  }

  .topnav.responsive .dropdown-content {
    position: static;
  }
}

/* ---------------------------------------------------------------------------
   Post list: links, meta and the division between entries.
   --------------------------------------------------------------------------- */

/* Scoped to main so it cannot recolour the nav (white), the Blog(s) menu
   (black) or the scroll cue. Bootstrap's default link blue was the only
   thing on the page not following the brand. */
main a,
main a:link,
main a:visited {
  color: var(--brand);
  text-underline-offset: 2px;
  text-decoration-color: var(--brand-line);
}

main a:hover,
main a:focus {
  color: var(--brand-dark);
  text-decoration-color: var(--brand-dark);
}

#index > li {
  /* Room to breathe, plus a hairline so one post clearly ends before the
     next begins - previously entries ran together with no separation. */
  margin-bottom: 4.5rem;
  padding-bottom: 3.5rem;
  border-bottom: 1px solid var(--brand-rule);
}

#index > li:last-child {
  margin-bottom: 2.5rem;
  padding-bottom: 0;
  border-bottom: none;
}

#index article h2,
article > h2 {
  margin-top: 0.75rem;
  margin-bottom: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}

#index article h2 a {
  text-decoration: none;
}

#index article h2 a:hover {
  text-decoration: underline;
}

/* Title, date and categories each get their own line. */
.entry-meta {
  display: block;
  margin: 0 0 1.5rem;
}

.entry-date {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-tag {
  /* inline-flex with a fixed height centres the label on the box itself.
     inline-block left it riding high, because Sarabun's ascent/descent
     metrics - not the padding - decided where the baseline landed. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 0.7rem;
  line-height: 1;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: lowercase;
  color: var(--brand-dark);
  background-color: var(--brand-tint);
  border: 1px solid var(--brand-line);
  border-radius: 999px;
}

.entry-body {
  line-height: 1.65;
}

.entry-body img,
.entry-body iframe,
.entry-body video {
  max-width: 100%;
}

.entry-body img {
  height: auto;
}

/* ---------------------------------------------------------------------------
   Footer, mirrored from ikhider.com. Brand bar so the page is bookended by
   the nav colour. The icons are dark artwork, so they are flipped to white
   for contrast against the brown.
   --------------------------------------------------------------------------- */
.site-footer {
  margin-top: 3rem;
  padding: 26px 20px;
  background-color: var(--brand);
  text-align: center;
}

.site-footer .social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
}

.site-footer .social a {
  display: inline-flex;
  opacity: 0.92;
}

.site-footer .social a:hover {
  opacity: 1;
}

.site-footer .social img {
  display: block;
  width: 30px;
  height: 30px;
  filter: brightness(0) invert(1);
}

/* ---------------------------------------------------------------------------
   Pagination. Brand colours instead of Bootstrap's blue. Previous/Next are
   only rendered when that page exists (see includes/pagination.php), so
   there is never a dead control to style.
   --------------------------------------------------------------------------- */
.pagination-nav {
  margin: 0 0 1rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Bootstrap styles .page-link heavily, so these need to win on specificity. */
.pagination .page-item .page-link,
main .pagination .page-item .page-link:link,
main .pagination .page-item .page-link:visited {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-dark);
  background-color: var(--brand-tint);
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  text-decoration: none;
}

.pagination .page-item .page-link:hover,
.pagination .page-item .page-link:focus,
main .pagination .page-item .page-link:hover,
main .pagination .page-item .page-link:focus {
  color: #fff;
  background-color: var(--brand);
  border-color: var(--brand);
  box-shadow: none;
}

/* Admin: search engine meta fields */
.meta-fieldset {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--brand-line);
  border-radius: 4px;
  background-color: rgba(130, 89, 53, 0.04);
}

.meta-fieldset legend {
  width: auto;
  padding: 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-dark);
}

.meta-hint {
  display: block;
  margin: 0.15rem 0 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Admin: category management */
.category-form {
  margin: 1rem 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.category-form input {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--brand-line);
  border-radius: 4px;
}

.category-form input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 0.15rem rgba(130, 89, 53, 0.25);
}

.category-form button {
  padding: 0.35rem 1rem;
  color: #fff;
  background-color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 4px;
  cursor: pointer;
}

.category-form button:hover {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
}

.form-errors {
  color: #b02a37;
  padding-left: 1.2rem;
  margin: 0.5rem 0 1rem;
}

main a.delete,
main a.delete:link,
main a.delete:visited {
  color: #b02a37;
}

main a.delete:hover {
  color: #842029;
}

/* ---------------------------------------------------------------------------
   Category and search pages
   --------------------------------------------------------------------------- */

/* Tags are links now: keep the pill look, drop the underline. */
main a.category-tag,
main a.category-tag:link,
main a.category-tag:visited {
  color: var(--brand-dark);
  text-decoration: none;
}

main a.category-tag:hover,
main a.category-tag:focus {
  color: #fff;
  background-color: var(--brand);
  border-color: var(--brand);
}

.page-heading {
  margin: 1.5rem 0 0.4rem;
  font-weight: 600;
}

.result-summary {
  margin: 0 0 2rem;
  font-style: italic;
  color: var(--muted);
}

.search-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 2rem;
}

.search-form input[type="search"] {
  flex: 1 1 260px;
  max-width: 420px;
  padding: 0.45rem 0.7rem;
  font-family: inherit;
  border: 1px solid var(--brand-line);
  border-radius: 4px;
}

.search-form input[type="search"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 0.15rem rgba(130, 89, 53, 0.25);
}

.search-form button {
  padding: 0.45rem 1.2rem;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background-color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 4px;
  cursor: pointer;
}

.search-form button:hover {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
}

/* Compact search in the nav bar. Floats like the nav links do. */
.topnav .nav-search {
  float: right;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 10px 6px;
}

.topnav .nav-search input[type="search"] {
  width: 150px;
  padding: 0.3rem 0.55rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: #fff;
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
}

.topnav .nav-search input[type="search"]::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

.topnav .nav-search input[type="search"]:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.22);
  border-color: #fff;
}

.topnav .nav-search button {
  padding: 0.3rem 0.6rem;
  color: #fff;
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  cursor: pointer;
}

.topnav .nav-search button:hover {
  color: var(--brand);
  background-color: #fff;
  border-color: #fff;
}

@media screen and (max-width: 600px) {
  .topnav .nav-search {
    display: none;
  }

  .topnav.responsive .nav-search {
    float: none;
    display: flex;
    padding: 10px 16px;
  }

  .topnav.responsive .nav-search input[type="search"] {
    flex: 1;
    width: auto;
  }
}

/* Categories sit at the foot of each entry, below the body.
   Deliberately NOT scoped as "article > .categories": most posts contain a
   stray </article> in their stored content, which closes the wrapper early,
   so the tag list is not actually a child of <article> in the parsed DOM. */
.categories {
  margin-top: 1.4rem;
  margin-bottom: 0.9rem;
}

/* ---------------------------------------------------------------------------
   Rhythm inside post bodies. The stored HTML has no spacing of its own, so
   images ran flush against the headings and paragraphs that follow them.
   --------------------------------------------------------------------------- */
.entry-body p {
  margin: 0 0 1.4rem;
}

.entry-body img,
.entry-body iframe,
.entry-body video,
.entry-body embed,
.entry-body object {
  display: block;
  margin: 2.2rem 0;
}

.entry-body h1,
.entry-body h2,
.entry-body h3,
.entry-body h4 {
  margin: 2.4rem 0 0.9rem;
  line-height: 1.3;
}

/* No double gap where a heading or paragraph opens the body. */
.entry-body > *:first-child {
  margin-top: 0;
}

.entry-body > *:last-child {
  margin-bottom: 0;
}

.entry-body blockquote {
  margin: 2rem 0;
  padding-left: 1.2rem;
  border-left: 3px solid var(--brand-line);
  color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Truncated hero for every page except the landing page. Same photograph,
   title and chevron - just short enough that the content starts above the
   fold, so arriving from a tag, a search or a post title puts you on the
   content rather than another full screen of splash.
   --------------------------------------------------------------------------- */
.hero-wrap.hero-short {
  height: 55vh;
  height: 55dvh;
  min-height: 260px;
  max-height: 560px;
}

/* The chevron shrinks to suit the reduced height, but the title and tagline
   stay at full size - there is ample room at 55vh and the wide band made
   smaller type look lost. */
.hero-short .masthead-inner h1 {
  font-size: 2.6rem;
}

.hero-short .masthead-inner .lead {
  font-size: 1.25rem;
}

.hero-short .scroll-cue {
  bottom: 12px;
  width: 64px;
  height: 64px;
  line-height: 64px;
  font-size: 38px;
}

@media (max-width: 600px) {
  .hero-wrap.hero-short {
    height: 45vh;
    height: 45dvh;
    min-height: 220px;
  }

  .hero-short .masthead-inner h1 {
    font-size: 1.9rem;
  }

  .hero-short .masthead-inner .lead {
    font-size: 1.05rem;
  }
}

/* The splash title is a link home. */
.masthead-inner h1 a,
.masthead-inner h1 a:link,
.masthead-inner h1 a:visited {
  color: #fff;
  text-decoration: none;
}

.masthead-inner h1 a:hover,
.masthead-inner h1 a:focus {
  color: #fff;
  opacity: 0.85;
}

/* ---------------------------------------------------------------------------
   Sticky footer: on short pages (an empty search, a single result) the footer
   used to sit mid-screen with blank space beneath it. Body becomes a column
   whose content wrapper grows, pushing the footer to the bottom of the
   viewport - while still flowing normally when the content is long.
   --------------------------------------------------------------------------- */
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0;
}

/* The hero must keep its own height rather than being shrunk by the column. */
body > .hero-wrap {
  flex: 0 0 auto;
}

/* The content wrapper takes up the slack. */
body > .container {
  flex: 1 0 auto;
  width: 100%;
  /* The sticky-footer rule below replaces .site-footer's margin-top with
     auto, which collapses to 0 on a full page - so the separation from the
     footer lives here instead. */
  padding-bottom: 3.5rem;
}

body > .site-footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* Video embeds carry fixed width/height attributes (e.g. 640x351), so
   max-width alone squashed them into a near-square box on a phone. Let the
   height follow the width instead. Scoped to video hosts: other embeds
   (audio players and the like) keep their own fixed height. */
.entry-body iframe[src*="vimeo.com"],
.entry-body iframe[src*="youtube.com"],
.entry-body iframe[src*="youtube-nocookie.com"] {
  height: auto;
  aspect-ratio: 16 / 9;
}
