/* Chessboard - A Free Design by Bryant Smith (bryantsmith.com)
   Everything you can see is set here. The section headings below will
   point you to the part you want to change. */

/* ---- PALETTE: five colours used over and over ---- */
:root {
    --ink:        #17130d;   /* the table under the board        */
    --panel:      #211a11;   /* slightly lifted panels           */
    --light:      #e9d9b3;   /* board light square               */
    --dark:       #6d4527;   /* board dark square                */
    --frame:      #3a2412;   /* the wooden frame around the board */
    --brass:      #c9a227;   /* single accent colour             */
    --text:       #ece4d3;   /* main reading colour              */
    --muted:      #a99b80;   /* quiet supporting text            */
    --serif: Georgia, "Times New Roman", Times, serif;
    --sans:  Verdana, Arial, Helvetica, sans-serif;
    --mono:  "Courier New", Courier, monospace;
    --chess: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", "Arial Unicode MS", serif;
}

/* ---- BASE: the dark room the board stands in ---- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--ink);
    background-image: radial-gradient(circle at 50% 0, #2a2013 0, var(--ink) 62%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.7;
    padding: 44px 16px 48px;
}

#page {
    margin: 0 auto;
    max-width: 960px;
    text-align: left;
}

a {
    color: var(--brass);
}

/* ---- MASTHEAD: the title band above the board ---- */
#masthead {
    background-image: linear-gradient(180deg, #2c2113 0, rgba(23, 19, 13, 0) 100%);
    border-bottom: 3px solid var(--brass);
    margin-bottom: 44px;
    padding: 10px 0 30px;
    text-align: center;
}

#masthead h1 {
    color: #f7f0dd;
    font-size: 46px;
    font-weight: normal;
    letter-spacing: 1px;
    line-height: 1.1;
}

.tagline {
    color: var(--muted);
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 3px;
    margin-top: 12px;
    text-transform: uppercase;
}

#menu {
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 2px;
    margin-top: 24px;
    text-transform: uppercase;
}

#menu a,
#menu a:visited {
    border-bottom: 2px solid transparent;
    color: var(--text);
    margin: 0 11px;
    padding-bottom: 3px;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

#menu a:hover,
#menu a:focus-visible {
    border-bottom: 2px solid var(--brass);
    color: var(--brass);
    outline: none;
}

/* ---- LAYOUT: board on the left, reading column on the right ---- */
#main {
    align-items: start;
    display: grid;
    gap: 48px;
    grid-template-columns: 430px minmax(0, 1fr);
}

#board-column {
    position: sticky;
    top: 28px;
}

/* ---- BOARD FRAME: the wooden border holding the squares ---- */
.board-frame {
    background-image: linear-gradient(160deg, #4a2f18, #29190c);
    border: 1px solid #5a3a1f;
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55),
                inset 0 0 0 1px rgba(201, 162, 39, 0.35);
    padding: 14px;
}

/* A small grid so the rank and file labels line up with the squares */
#board-area {
    display: grid;
    gap: 0;
    grid-template-columns: 18px 1fr;
    grid-template-rows: 1fr 18px;
}

.ranks {
    align-items: center;
    color: var(--muted);
    display: grid;
    font-family: var(--sans);
    font-size: 10px;
    grid-column: 1;
    grid-row: 1;
    grid-template-rows: repeat(8, 1fr);
    justify-items: center;
}

.files {
    align-items: center;
    color: var(--muted);
    display: grid;
    font-family: var(--sans);
    font-size: 10px;
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: repeat(8, 1fr);
    justify-items: center;
}

/* ---- THE BOARD: an 8 by 8 grid painted with one repeating gradient ----
   The conic gradient draws a 2x2 checker inside each 25% tile; because the
   tile is one quarter of the board, the checks line up with the grid squares. */
#board {
    aspect-ratio: 1 / 1;
    background-image: repeating-conic-gradient(var(--light) 0 25%, var(--dark) 0 50%);
    background-size: 25% 25%;
    border: 2px solid #1c1108;
    display: grid;
    font-size: clamp(15px, 4vw, 30px);
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    position: relative;
}

/* ---- PIECES THAT MARK A SECTION (the ringed, clickable ones) ---- */
.piece {
    display: grid;
    place-items: center;
    position: relative;
    text-decoration: none;
}

/* a soft gold wash over the whole square on hover / keyboard focus */
.piece::before {
    background: rgba(201, 162, 39, 0.30);
    border-radius: 6px;
    content: "";
    inset: 4%;
    opacity: 0;
    position: absolute;
    transition: opacity 0.15s ease;
}

.piece:hover::before,
.piece:focus-visible::before {
    opacity: 1;
}

.piece:focus-visible {
    outline: none;
}

.token {
    align-items: center;
    background: var(--light);
    border: 2px solid var(--brass);
    border-radius: 50%;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45), inset 0 -2px 4px rgba(0, 0, 0, 0.18);
    color: #241708;
    display: grid;
    font-family: var(--chess);
    font-size: 1em;
    height: 1.62em;
    justify-items: center;
    line-height: 1;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    width: 1.62em;
}

.piece:hover .token,
.piece:focus-visible .token {
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.35), 0 4px 7px rgba(0, 0, 0, 0.5);
    transform: scale(1.08);
}

/* ---- DECORATIVE PIECES: a cream halo keeps them readable on any square ---- */
.piece-plain {
    color: #241708;
    display: grid;
    font-family: var(--chess);
    font-size: 1.35em;
    line-height: 1;
    place-items: center;
    text-shadow: 0 0 1px #f3e6c8, 0 0 3px #f3e6c8, 0 0 6px rgba(243, 230, 200, 0.55);
    user-select: none;
}

/* ---- SQUARE COORDINATES: grid-area is row / column (row 1 is rank 8) ---- */
.sq-a8 { grid-area: 1 / 1; }  .sq-c8 { grid-area: 1 / 3; }
.sq-d8 { grid-area: 1 / 4; }  .sq-e8 { grid-area: 1 / 5; }
.sq-g8 { grid-area: 1 / 7; }

.sq-b7 { grid-area: 2 / 2; }  .sq-f7 { grid-area: 2 / 6; }

.sq-c5 { grid-area: 4 / 3; }

.sq-d4 { grid-area: 5 / 4; }  .sq-g4 { grid-area: 5 / 7; }

.sq-h3 { grid-area: 6 / 8; }

.sq-b2 { grid-area: 7 / 2; }  .sq-f2 { grid-area: 7 / 6; }

.sq-a1 { grid-area: 8 / 1; }  .sq-c1 { grid-area: 8 / 3; }
.sq-d1 { grid-area: 8 / 4; }  .sq-e1 { grid-area: 8 / 5; }
.sq-g1 { grid-area: 8 / 7; }

.board-caption {
    color: var(--muted);
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 0.5px;
    margin-top: 16px;
    text-align: center;
}

/* ---- READING COLUMN ---- */
#content {
    min-width: 0;
}

.lead {
    color: #f2ebd9;
    font-size: 20px;
    line-height: 1.65;
    margin-bottom: 28px;
}

.lead::first-letter {
    color: var(--brass);
    float: left;
    font-size: 3.3em;
    line-height: 0.82;
    padding: 5px 10px 0 0;
}

#content p {
    margin-bottom: 18px;
}

#content a,
#content a:visited {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: rgba(201, 162, 39, 0.45);
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

#content a:hover {
    color: #f0cd67;
    text-decoration-color: #f0cd67;
}

#content h2 {
    border-bottom: 1px solid rgba(201, 162, 39, 0.28);
    color: var(--brass);
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 3px;
    margin: 40px 0 16px;
    padding-bottom: 10px;
    text-transform: uppercase;
}

#content h2::before {
    color: var(--muted);
    content: "\265F\00A0\00A0";
}

/* ---- SCORESHEET: the "moves" list of sections ---- */
.moves-intro {
    color: var(--muted);
    font-size: 15px;
}

.moves {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(201, 162, 39, 0.28);
    border-radius: 8px;
    list-style: none;
    margin: 6px 0 8px;
    overflow: hidden;
}

.moves li {
    border-bottom: 1px solid rgba(201, 162, 39, 0.14);
}

.moves li:last-child {
    border-bottom: none;
}

.move {
    align-items: center;
    color: var(--text);
    display: grid;
    gap: 10px;
    grid-template-columns: 26px 26px 40px 1fr auto;
    padding: 12px 16px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.move:hover,
.move:focus-visible {
    background: rgba(201, 162, 39, 0.13);
    color: #ffffff;
    outline: none;
}

.move-no {
    color: var(--muted);
    font-family: var(--sans);
    font-size: 11px;
}

.move-piece {
    color: var(--light);
    font-family: var(--chess);
    font-size: 20px;
    line-height: 1;
}

.move-sq {
    color: var(--brass);
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 1px;
}

.move-name {
    font-family: var(--sans);
    font-size: 13px;
    letter-spacing: 1px;
}

.move-arrow {
    color: var(--muted);
    font-size: 18px;
}

/* ---- ENTRIES: the project and writing lists ---- */
.entries {
    list-style: none;
}

.entries li {
    border-bottom: 1px solid rgba(201, 162, 39, 0.14);
    padding: 12px 0;
}

.entries li:last-child {
    border-bottom: none;
}

.entries .tag {
    color: var(--muted);
    display: inline-block;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    width: 74px;
}

.entries a {
    font-size: 18px;
}

/* ---- QUOTE ---- */
blockquote {
    border-left: 3px solid var(--brass);
    color: #d8cdb6;
    font-size: 19px;
    font-style: italic;
    margin: 26px 0;
    padding: 2px 0 2px 22px;
}

blockquote p {
    margin: 0;
}

blockquote cite {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-style: normal;
    letter-spacing: 1px;
    margin-top: 8px;
}

/* ---- NOTE: plain-English help box ---- */
.note {
    background: rgba(201, 162, 39, 0.07);
    border-left: 3px solid var(--brass);
    border-radius: 0 8px 8px 0;
    margin-top: 44px;
    padding: 22px 24px 8px;
}

.note h3 {
    color: var(--brass);
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 2px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.note p {
    color: #d8cdb6;
    font-size: 15px;
}

.note code {
    color: var(--brass);
    font-family: var(--mono);
    font-size: 0.92em;
}

/* ---- FOOTER: the required credit link ---- */
#footer {
    border-top: 1px solid rgba(201, 162, 39, 0.3);
    color: var(--muted);
    font-family: var(--sans);
    font-size: 10px;
    letter-spacing: 1px;
    margin-top: 56px;
    padding-top: 22px;
    text-align: center;
    text-transform: uppercase;
}

#footer a,
#footer a:visited {
    color: var(--muted);
    text-decoration: none;
}

#footer a:hover {
    color: var(--brass);
}

/* ---- MEDIUM SCREENS: let the board sit above the text ---- */
@media (max-width: 820px) {
    #main {
        gap: 40px;
        grid-template-columns: 1fr;
    }

    #board-column {
        margin: 0 auto;
        max-width: 440px;
        position: static;
        width: 100%;
    }
}

/* ---- SMALL SCREENS: tighten padding and type ---- */
@media (max-width: 640px) {
    body {
        padding: 26px 14px 32px;
    }

    #masthead {
        margin-bottom: 30px;
        padding-bottom: 22px;
    }

    #masthead h1 {
        font-size: 33px;
    }

    #menu a {
        margin: 0 7px;
    }

    .lead {
        font-size: 18px;
    }

    .move {
        gap: 8px;
        grid-template-columns: 20px 22px 38px 1fr auto;
        padding: 11px 12px;
    }

    .entries .tag {
        display: block;
        margin-bottom: 2px;
        width: auto;
    }
}

/* ---- PRINT: drop the dark table and the board, keep the words ---- */
@media print {
    body {
        background: #ffffff;
        color: #000000;
        padding: 0;
    }

    #board-column,
    #masthead {
        display: none;
    }

    #main {
        display: block;
    }

    #content h2,
    .note h3,
    .entries .tag,
    .move-sq {
        color: #000000;
    }

    #footer {
        color: #555555;
    }
}
