/*
File Location: \style.css
Environment: Production (Client-Side).
*/

/* -----------------------------------------
    Typography & Fonts
    ----------------------------------------- */
@font-face {
    font-family: 'Frank Ruhl Libre';
    src: url('/FrankRuhlLibre-VariableFont_wght.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

/* -----------------------------------------
    CSS Variables
    ----------------------------------------- */
:root {
    --f: 0.875rem;
    --p: 1rem;
    --m: 1.5rem;
    --np: calc(-1 * var(--p));

    --bg-body: #000;
    --bg-main: #FBF0D9;
    --bg-sec: #D4C7B3;
    --text-main: #5F4B32;
    --text-muted: #7F6546;
}

html[lang="he-IL"] {
    --h1-font-size: 13.9cqw;
}

html[lang="en"] {
    --h1-font-size: 9.5cqw;
}

/* -----------------------------------------
    Reset & Base Styles
    ----------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    box-sizing: border-box;
}

html {
    font-size: 112.5%;
}

body {
    font-family: 'Frank Ruhl Libre', serif;
    color: var(--text-main);
    background: var(--bg-body);
    display: grid;
    grid-template-columns: 1fr min(calc(66ch + 2 * var(--p)), 100%) 1fr;
    align-items: start;
}

/* -----------------------------------------
    Layout Containers
    ----------------------------------------- */
main {
    grid-area: 1 / 2;
}

article {
    background: var(--bg-main);
    line-height: 1.5;
    padding: var(--p);
    overflow-wrap: break-word;
}

/* -----------------------------------------
    Headings & Paragraphs
    ----------------------------------------- */
:is(h2, h3, h4, h5) {
    margin-block: var(--m);
}

p+p {
    margin-top: var(--m);
}

q {
    font-weight: 700;
}

/* -----------------------------------------
    Links
    ----------------------------------------- */
a {
    color: inherit;
    text-decoration: none;
}

a:hover,
.list-title {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

:is(h2, h3, h4, h5, address, footer) a:hover {
    text-decoration: none;
}

/* -----------------------------------------
    Header & Footer
    ----------------------------------------- */
header,
footer {
    background: var(--bg-sec);
    padding-inline: var(--p);
    margin-inline: var(--np);
}

header {
    margin-block: var(--np) var(--m);
    container-type: inline-size;
}

header h1 {
    font-weight: 900;
    font-size: var(--h1-font-size);
    text-align: center;
    white-space: nowrap;
}

header p {
    font-weight: 500;
}

address,
footer {
    font-weight: 900;
    text-align: center;
    margin-inline: var(--np);
}

address {
    font-style: normal;
    color: #2B3B4C;
}

footer {
    color: #2B3B4C;
    margin-block: var(--m) var(--np);
}

/* -----------------------------------------
    Media & Figures
    ----------------------------------------- */
figure {
    display: table;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

figcaption {
    color: var(--text-muted);
    font-size: var(--f);
    display: table-caption;
    caption-side: bottom;
}

figure:has(figcaption)+p {
    margin-top: var(--f);
}

/* -----------------------------------------
    Navigation & Table of Contents
    ----------------------------------------- */
nav {
    grid-area: 1 / 1;
    top: 0;
    position: sticky;
    border: 2px solid;
    padding: 3px;
    display: flex;
    flex-direction: column;
    justify-self: start;
    background: var(--bg-main);
    font-weight: 700;
}

nav label {
    color: #2B3B4C;
}

select {
    background: var(--bg-main);
    color: inherit;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
}

select option:checked {
    background: var(--bg-sec);
}

/* -----------------------------------------
    Lists & Modifiers
    ----------------------------------------- */

.list-title {
    font-size: 1rem;
    margin-bottom: 0;
}

.reference-link {
    list-style-type: square;
}

.wikiquote-link {
    list-style-type: circle;
}

.H1,
.H2 {
    font-weight: 900;
}

.H3 {
    font-weight: 500;
}

.H5 {
    font-weight: 100;
    color: var(--text-muted);
}

/* -----------------------------------------
    Contact Link Feedback (No Layout Shift)
    ----------------------------------------- */

#contact-link {
    position: relative;
    display: inline-block;
    padding-inline-end: 15px;
    transition: color 0.2s ease;
}

#contact-link::after {
    content: '✓';
    position: absolute;
    inset-inline-end: 0;
    top: 50%;
    transform: translateY(-50%) scale(0);
    color: #2e7d32;
    font-weight: 900;
    font-size: 0.95rem;
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#contact-link.copied::after {
    transform: translateY(-50%) scale(1);
    opacity: 1;
}

#contact-link.copied {
    color: #2e7d32;
}

/* -----------------------------------------
    Responsive Layout
    ----------------------------------------- */
@media (max-width: 840px) {
    html {
        font-size: 125%;
    }

    nav {
        grid-area: 2 / 2;
        width: 100%;
        top: auto;
        bottom: 0;
    }
}