/* ==================================================
   SLIM BAR + INK DIVIDERS

   Two small additions to the site, both safe to
   paste into style.css instead of linking this
   file, whichever you prefer.

   1. THE SLIM BAR - the one-line header on every
      page, home included. It reuses the
      .nav-drop-menu styles already in style.css,
      so this file only builds the bar itself and
      overrides the couple of dropdown rules that
      were written for the big header's cards.

      Bar order, left to right: logo, scrolling
      address, site name, Menu button.

   2. THE INK DIVIDER - a class for your scanned
      handdrawn divider lines, so they drop in
      anywhere with one img tag.

   VERSION NOTES (things fixed since v1):
   - the menu now sits flush under the Menu
     button, no 6px gap, so it can't vanish
     while you move the mouse towards it
   - an invisible "hover bridge" keeps the menu
     open while the cursor crosses to it
   - the Menu button's bottom-right corner and
     the menu's top-right corner are squared, so
     the two meet as one shape; every other
     corner keeps the site's rounding
================================================== */


/* --------------------------------------------------
   1. THE SLIM BAR

   A flex row: brand on the left, Menu on the
   right. Sticky, so it stays at the top while
   you scroll. Its bottom border is a thin paper-
   coloured rule that separates it from the page.
-------------------------------------------------- */

.slim-bar {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 16px;

    width: 100%;

    padding: 10px 20px;

    background: var(--paper-light);

    border-bottom: 1px solid var(--border);

    position: sticky;

    top: 0;

    z-index: 100;
}


/* the brand: just the logo, a link home */

.slim-brand {
    display: flex;

    align-items: center;

    gap: 10px;

    text-decoration: none;

    color: var(--green-dark);
}


.slim-logo {
    width: 30px;

    height: 30px;

    object-fit: contain;
}


/* the site name was removed by request: the bar
   is now logo, typed address, Menu button. The
   typed address keeps the space after it free
   (margin-right: auto), which is what pins the
   Menu button to the right-hand edge */


/* the Menu button

   style.css styles .nav-drop-toggle as a tiny
   arrow pinned to the corner of a nav card.
   Inside the slim bar it needs to be a normal,
   inline button instead, so the rules below
   reset that. This file loads after style.css,
   so at equal specificity these win.

   The bottom-right corner is squared on purpose:
   the dropdown opens directly beneath this
   corner, and the menu's top-right corner is
   squared to meet it, so the two read as one
   shape when the menu is open. */

.slim-menu-btn {
    position: static;

    top: auto;

    right: auto;

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 8px 12px;

    background: transparent;

    border: 1px solid var(--border);

    border-radius: var(--radius);

    border-bottom-right-radius: 0;

    color: var(--green-dark);

    font-family: var(--font-mono);

    font-size: .68rem;

    letter-spacing: .1em;

    text-transform: uppercase;

    cursor: pointer;

    /* phones: no double-tap zoom on the button,
       and no grey flash box on tap */

    touch-action: manipulation;

    -webkit-tap-highlight-color: transparent;

    transition:
        background .2s ease,
        color .2s ease;
}


/* when the menu is open the button and the menu
   share a background, so the button loses its
   own bottom border; the menu carries the line
   across instead, making one unbroken outline */

.nav-drop.open .slim-menu-btn,
.nav-drop:hover .slim-menu-btn,
.nav-drop:focus-within .slim-menu-btn {
    border-bottom-color: transparent;
}


.slim-menu-btn:hover,
.slim-menu-btn:focus-visible {
    background: var(--green-dark);

    color: var(--paper-light);
}


/* the Menu button's arrow flips when open */

.slim-menu-btn .drop-arrow {
    display: inline-block;

    transition: transform .2s ease;
}


.nav-drop.open .slim-menu-btn .drop-arrow {
    transform: rotate(180deg);
}


/* the hover bridge

   An invisible strip hanging below the Menu
   button. It is not part of the button, but the
   browser counts it towards "hovering over the
   dropdown", so the menu stays open while the
   cursor travels down to it, and forgives small
   slips off the edge. The menu itself sits above
   it (z-index 60 in style.css), so clicks still
   land on the links where they overlap. */

.nav-drop::after {
    content: "";

    position: absolute;

    top: 100%;

    left: 0;

    right: 0;

    height: 14px;
}


/* the menu itself reuses .nav-drop-menu from
   style.css. The tweaks:

   - top: 100% makes it sit FLUSH under the
     button (no gap), which is what stops it
     disappearing mid-crossing
   - the squared top-right corner meets the
     squared bottom-right corner of the button
   - no top border of its own, so the button's
     bottom border is the single line between
     them and the outline reads as one box */

.slim-menu {
    top: 100%;

    right: 0;

    min-width: 230px;

    border-top: none;

    border-top-right-radius: 0;
}


.nav-drop:hover .slim-menu,
.nav-drop:focus-within .slim-menu,
.nav-drop.open .slim-menu {
    opacity: 1;

    visibility: visible;

    transform: translateY(0);
}


.slim-menu a {
    display: flex;

    align-items: center;

    gap: 12px;

    width: auto;

    min-width: 0;

    /* the same tap treatment as the button: the
       link responds on the first clean tap */

    touch-action: manipulation;

    -webkit-tap-highlight-color: transparent;
}


/* the menu links are plain text now: no icons,
   no dots, just the words, so the list reads
   like a typed index */


/* on very narrow screens the site name can hide,
   leaving just the logo and the Menu button */

@media (max-width: 420px) {
    .slim-brand {
        flex: 1;
    }
}


/* --------------------------------------------------
   2. THE TYPEWRITER ADDRESS

   flatlandpeasant.co.uk types itself out right
   after the logo, one letter at a time (the
   typing is done by header.js), then the caret
   keeps blinking quietly. aria-hidden in the
   HTML keeps screen readers out of it.
-------------------------------------------------- */

.header-type {
    overflow: hidden;

    white-space: nowrap;

    margin-left: 16px;

    /* the free space after the address is claimed
       here, so the Menu button sits hard against
       the right edge */

    margin-right: auto;
}


.type-text {
    color: var(--text-soft);

    font-family: var(--font-mono);

    font-size: 0.62rem;

    letter-spacing: 0.22em;

    text-transform: uppercase;

    opacity: .75;
}


.type-caret {
    color: var(--green-dark);

    font-family: var(--font-mono);

    font-size: 0.62rem;

    margin-left: 2px;

    animation: caretBlink 1.1s steps(1) infinite;
}


@keyframes caretBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

}


/* on very narrow screens the typewriter hides
   with the site name: the bar stays one tidy
   line */

@media (max-width: 420px) {
    .header-type {
        display: none;
    }
}


/* --------------------------------------------------
   2. THE INK DIVIDER

   For your scanned handdrawn lines. Put the scans
   in a folder called images/dividers/, then place
   one anywhere on a page with:

   <img src="images/dividers/ink-line.png" alt="" class="ink-divider">

   alt="" because the line is decoration, and
   screen readers should skip it.

   The class keeps the scan at a sensible size,
   centred, with paper-friendly spacing either
   side, and stops it ever stretching past the
   page edge on a phone.
-------------------------------------------------- */

.ink-divider {
    display: block;

    width: min(340px, 60%);

    height: auto;

    margin: 48px auto;
}


/* a full-width variant for long horizontal rules
   that should run edge to edge of the text column:

   <img src="images/dividers/rule.png" alt="" class="ink-divider ink-divider--wide">
*/

.ink-divider--wide {
    width: min(720px, 100%);
}
