/* ---------------------------------------------------------------------------
   Palette: black, white and the nav grey from the brief, plus one optional
   green accent.

   White on the nav grey (#7b7b7b) is only 4.23:1, below the 4.5:1 needed
   for normal-size text, so the nav text is black on grey (4.96:1).

   The green is a "maybe" in the brief. It only appears through --accent
   (links, focus rings), so setting --accent to var(--white) removes it.
   --------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --black: #000;
  --white: #fff;
  --text: #e6e6e6;        /* body text on black: 16.9:1 */
  --grey: #7b7b7b;        /* nav bar and rules */
  --grey-text: #a3a3a3;   /* secondary text on black: 8.3:1 */
  --accent: #7fa67a;      /* links and focus on black: 7.6:1 */

  --nav-h: 56px;

  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body: 'Sarabun', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-type: 'Special Elite', 'Courier New', Courier, monospace;
}

/* ---------------------------------------------------------------------------
   Sarabun, the house face across the ikhider.com sites. One family with real
   weight/style descriptors so <strong> and <em> pick the right file.
   Oswald and Special Elite come from Google Fonts (see includes/header.php).
   --------------------------------------------------------------------------- */
@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;
}

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

html {
  background-color: var(--black);
}

/* Column layout so the footer sits at the bottom on short pages. */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

main {
  flex: 1 0 auto;
}

img {
  max-width: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--white);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: -9999px;
  z-index: 100;
  padding: 0.6rem 1rem;
  color: var(--black);
  background-color: var(--white);
}

.skip-link:focus {
  left: 8px;
}

/* ---------------------------------------------------------------------------
   Navigation: a grey bar on wide screens, a menu button over the clipping on
   narrow ones (as in the mobile sketch).
   --------------------------------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 40;
}

.site-nav {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  padding: 0 12px;
  white-space: nowrap;
  background-color: var(--grey);
}

.nav-links {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a,
.site-nav a:visited,
.nav-dropdown > button {
  display: block;
  padding: 0 14px;
  line-height: var(--nav-h);
  font-family: inherit;
  font-size: 1rem;
  color: var(--black);
  text-decoration: none;
}

.site-nav a:hover,
.nav-dropdown > button:hover,
.nav-dropdown > button[aria-expanded="true"] {
  color: var(--white);
  background-color: var(--black);
}

.site-nav a[aria-current="page"] {
  box-shadow: inset 0 -3px 0 var(--black);
}

/* Black ring on grey: 4.96:1. The green would be too faint here. */
.site-nav :focus-visible {
  outline: 2px solid var(--black);
  outline-offset: -6px;
}

/* Blog(s) menu. Opens on hover for a mouse, and on click/Enter for touch
   and keyboard (js/nav.js keeps aria-expanded in step). */
.nav-dropdown {
  position: relative;
}

.nav-dropdown > button {
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.nav-dropdown > button::after {
  content: "";
  display: inline-block;
  margin-left: 0.45em;
  vertical-align: middle;
  border: 5px solid transparent;
  border-top-color: currentColor;
  border-bottom: 0;
}

.nav-dropdown > ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background-color: var(--black);
  border: 1px solid var(--grey);
}

/* ~ rather than +: the mobile-only label sits between the button and list. */
.nav-dropdown > button[aria-expanded="true"] ~ ul {
  display: block;
}

@media (hover: hover) {
  .nav-dropdown:hover > ul {
    display: block;
  }
}

.site-nav .nav-dropdown > ul a,
.site-nav .nav-dropdown > ul a:visited {
  padding: 10px 16px;
  line-height: 1.4;
  color: var(--white);
}

.site-nav .nav-dropdown > ul a:hover {
  color: var(--black);
  background-color: var(--grey);
}

.site-nav .nav-dropdown > ul :focus-visible {
  outline-color: var(--white);
}

/* Only shown in the mobile menu, where the dropdown is laid out flat. */
.nav-group-label {
  display: none;
}

.nav-toggle {
  display: none;
}

/* ---------------------------------------------------------------------------
   Split layout: the clipping on the left, a rule, text on the right.
   --------------------------------------------------------------------------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* The clipping is a 3:1 strip of about nine figures (one per ~155px of the
   1438px image). Height is the smaller of the panel height and 97vw: on wide
   screens that is the panel height, so the strip covers the panel; in a
   half-width panel on a phone it keeps roughly 1.6 figures across, centred,
   instead of one cropped torso. 52.85% is the centre figure (x = 760). */
.split-art {
  background-color: var(--black);
  background-image: url('/images/bg.jpg');
  background-repeat: no-repeat;
  background-position: 52.85% 50%;
  background-size: cover;
  background-size: auto min(100%, 97vw);
}

.split-text {
  border-left: 2px solid var(--grey);
}

/* Landing: nav + split fill exactly one screen. */
.split-hero {
  height: calc(100vh - var(--nav-h));
  height: calc(100dvh - var(--nav-h));
  min-height: 360px;
}

.split-hero .split-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
}

.site-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 9vw, 7.5rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white);
}

.site-title span {
  display: block;
}

.site-subtitle {
  margin: 1rem 0 0;
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--grey-text);
}

.enter-link {
  margin: 2.2rem 0 0;
}

.enter-link a,
.enter-link a:visited {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
  border-bottom: 1px solid currentColor;
}

.enter-link a:hover {
  color: var(--white);
}

/* Content pages: the clipping holds still while the text scrolls. */
.split-content .split-art {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
}

.split-content .split-text {
  padding: 3rem clamp(1.5rem, 5vw, 5rem) 4rem;
}

.page-heading {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
}

.placeholder-note {
  margin: 0 0 2.5rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--grey-text);
}

/* Small "Minaret" link above a post or tag heading. */
.eyebrow {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow a,
.eyebrow a:visited {
  color: var(--grey-text);
  text-decoration: none;
}

.eyebrow a:hover {
  color: var(--white);
}

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

/* ---------------------------------------------------------------------------
   Minaret: post list and single post
   --------------------------------------------------------------------------- */
.entry-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry-list > li {
  margin-bottom: 3.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(123, 123, 123, 0.45);
}

.entry-list > li:last-child {
  margin-bottom: 2rem;
  padding-bottom: 0;
  border-bottom: 0;
}

.entry-list h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.entry-list h2 a,
.entry-list h2 a:visited {
  color: var(--white);
  text-decoration: none;
}

.entry-list h2 a:hover {
  color: var(--accent);
}

.entry-meta {
  margin: 0 0 1.5rem;
}

.entry-date {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-text);
}

.entry-body,
.post {
  max-width: 40rem;
}

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

.entry-body p {
  margin: 0 0 1.4rem;
}

.entry-body h1,
.entry-body h2,
.entry-body h3,
.entry-body h4 {
  margin: 2.4rem 0 0.9rem;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.03em;
  color: var(--white);
}

.entry-body img,
.entry-body iframe,
.entry-body video,
.entry-body embed,
.entry-body object,
.post-image {
  display: block;
  max-width: 100%;
  margin: 2.2rem 0;
}

.entry-body img,
.post-image {
  height: auto;
}

/* Video embeds carry fixed width/height attributes, so max-width alone
   squashes them on a phone. Audio players keep their own 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;
}

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

.entry-body > *:first-child {
  margin-top: 0;
}

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

/* Bryn's poetry: wrap a poem in <div class="poem"> in the post content and
   it is set in the typewriter face, keeping its line breaks. */
.poem {
  margin: 2rem 0;
  font-family: var(--font-type);
  font-size: 1.125rem;
  line-height: 1.75;
  white-space: pre-line;
}

/* Tags sit at the foot of each post. Not scoped as "article > .categories":
   stored post HTML can contain a stray </article> that closes it early. */
.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
}

.category-tag,
.category-tag:visited {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  text-decoration: none;
  color: var(--text);
  background-color: rgba(123, 123, 123, 0.18);
  border: 1px solid var(--grey);
  border-radius: 999px;
}

.category-tag:hover {
  color: var(--black);
  background-color: var(--grey);
}

/* Previous / Next. Only rendered when that page exists. */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.page-link,
.page-link:visited {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1.2rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--black);
  background-color: var(--grey);
  border-radius: 999px;
}

.page-link:hover {
  color: var(--black);
  background-color: var(--white);
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0 2.5rem;
}

.search-form input[type="search"] {
  flex: 1 1 220px;
  max-width: 26rem;
  min-width: 0;
}

/* ---------------------------------------------------------------------------
   Forms: Minaret search, login and the admin pages.
   --------------------------------------------------------------------------- */
input,
textarea,
select,
button {
  font: inherit;
}

.search-form input[type="search"],
.form-control {
  padding: 0.5rem 0.7rem;
  color: var(--white);
  background-color: #111;
  border: 1px solid var(--grey);
  border-radius: 3px;
}

.form-control {
  display: block;
  width: 100%;
}

textarea.form-control {
  min-height: 14rem;
}

.search-form input[type="search"]:focus,
.form-control:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.search-form button,
.btn,
.category-form button,
.page-plain form button {
  padding: 0.5rem 1.3rem;
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--black);
  background-color: var(--grey);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

.search-form button:hover,
.btn:hover,
.category-form button:hover,
.page-plain form button:hover {
  background-color: var(--white);
}

/* ---------------------------------------------------------------------------
   Plain single-column pages: admin and login.
   --------------------------------------------------------------------------- */
.page-plain {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 2.5rem 16px 4rem;
}

.page-plain h2 {
  margin: 0 0 1.2rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--white);
}

.page-plain article p,
.page-plain article img {
  max-width: 100%;
}

.form-group {
  margin: 0 0 1.2rem;
}

.form-group label,
.category-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.page-plain fieldset {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--grey);
  border-radius: 3px;
}

.page-plain legend {
  padding: 0 0.5rem;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0;
}

.meta-hint {
  display: block;
  margin: 0.2rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--grey-text);
}

.category-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
  margin: 1rem 0 2rem;
}

.category-form input {
  padding: 0.45rem 0.7rem;
  color: var(--white);
  background-color: #111;
  border: 1px solid var(--grey);
  border-radius: 3px;
}

.form-errors {
  margin: 0.5rem 0 1rem;
  color: #ff8a80;   /* 9.2:1 on black */
}

.table {
  width: 100%;
  margin: 1rem 0 2rem;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.6rem 0.5rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(123, 123, 123, 0.45);
}

.table th {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-text);
}

a.delete,
a.delete:visited {
  color: #ff8a80;
}

.page-plain a + a {
  margin-left: 0.8rem;
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */
.site-footer {
  padding: 22px 16px;
  background-color: var(--black);
  border-top: 1px solid var(--grey);
}

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

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

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

/* The icon artwork is black; flip it to white on the black footer. */
.site-footer .social img {
  display: block;
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

/* ---------------------------------------------------------------------------
   Narrow screens. The nav needs ~480px on one line (~640px with the admin
   links), so phones get the menu button instead. Everything that hides the nav is scoped to
   .js, so without JavaScript the bar simply stays visible.
   --------------------------------------------------------------------------- */
@media (max-width: 700px) {

  .js .site-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
  }

  .js .nav-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--grey);
    border-radius: 4px;
    cursor: pointer;
  }

  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--white);
    transition: transform 0.2s ease, background-color 0.2s ease;
  }

  .nav-toggle-bars {
    position: relative;
  }

  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .nav-toggle-bars::before {
    top: -7px;
  }

  .nav-toggle-bars::after {
    top: 7px;
  }

  /* Bars become a cross while the menu is open. */
  .nav-toggle[aria-expanded="true"] .nav-toggle-bars {
    background-color: transparent;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
    transform: translateY(-7px) rotate(-45deg);
  }

  .js .site-nav {
    display: none;
  }

  /* Open menu: a full-screen grey panel, links stacked. */
  .nav-open {
    overflow: hidden;
  }

  .nav-open .site-nav {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 76px 24px 32px;
    overflow-y: auto;
    white-space: normal;
  }

  .nav-open .nav-links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .nav-open .site-nav a,
  .nav-open .site-nav a:visited {
    padding: 8px 0;
    line-height: 1.3;
    font-size: 1.35rem;
  }

  .nav-open .site-nav a:hover {
    color: var(--white);
    background-color: transparent;
    text-decoration: underline;
  }

  .nav-open .site-nav a[aria-current="page"] {
    box-shadow: none;
    text-decoration: underline;
    text-decoration-thickness: 3px;
  }

  .nav-open .site-nav :focus-visible {
    outline-offset: 2px;
  }

  /* The Blog(s) links are listed flat under a label. */
  .nav-open .nav-dropdown > button {
    display: none;
  }

  .nav-open .nav-group-label {
    display: block;
    margin-top: 14px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--black);
  }

  .nav-open .nav-dropdown > ul {
    position: static;
    display: block;
    min-width: 0;
    padding: 0 0 0 16px;
    background: none;
    border: 0;
    border-left: 2px solid var(--black);
  }

  .nav-open .site-nav .nav-dropdown > ul a,
  .nav-open .site-nav .nav-dropdown > ul a:visited {
    color: var(--black);
  }

  .nav-open .site-nav .nav-dropdown > ul a:hover {
    color: var(--white);
    background: none;
  }

  .nav-open .site-nav .nav-dropdown > ul :focus-visible {
    outline-color: var(--black);
  }

  /* With no bar, the landing split is the whole screen. */
  .js .split-hero {
    height: 100vh;
    height: 100dvh;
  }
}

/* Phones: content pages stack, the clipping becoming a band over the text. */
@media (max-width: 700px) {
  .split-content {
    grid-template-columns: 1fr;
  }

  .split-content .split-art {
    position: relative;
    height: 38vh;
    height: 38dvh;
    min-height: 220px;
  }

  .split-content .split-text {
    padding: 2rem 16px 3rem;
    border-left: 0;
    border-top: 2px solid var(--grey);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    transition: none;
  }
}

/* Running text on the About / Contact / Order pages. */
.page-body {
  max-width: 40rem;
  line-height: 1.7;
}

.page-body p {
  margin: 0 0 1.4rem;
}
