/*

    Hullo hullo! Welcome to my `style.css` file. This sets up all sorts of boilerplate for the rest of my site.
    I’ll be trying my best to comment you through it.

*/

/* `:root` is just CSS fancy talk for the <html> element — the *root* element of the page. */
:root {

    /* These primary colours are going to be repeated a lot.
       These are *CSS variables*, meaning that the values are automatically slotted in wherever you get, say, var(--text).
       This is helpful because it means I don’t have to repeat myself over and over again every time I want to make a change to a page.
       It’s surprisingly easier to make individual pages now than it was in the aughts, when they were all the range.
       Odd.
    */

    /* `--background` is the background colour of the page. */
    --background: #1C0F27;

    /* `--text` is the colour of regular, unadorned text. */
    --text: #FFFE;

    /* `--accent` is the chief accent colour. It’s used for links, emphasis, <details>es... the works! */
    --accent: #CE619D;

    /* There's an important distinction here. `--accent_translucent` is for fainter but still readable text; `--accent_seethrough` is meant for backgrounds. */
    --accent_translucent: #CE619D88; 
    --accent_seethrough: #CE619D22;

    /* Embarrassingly, this only works on Firefox. Chrome has its own weird thing going on. */
    scrollbar-color: var(--accent) var(--background);
    
    /* Fonts! Yes!
       There are separate CSS files to actually *load* the web fonts.
    */

    /*
        `--system` cycles through a bunch of different fonts in the hopes of finding the one that's natively used by your operating system.
        
        * system-ui: On modern browsers, automatically matches your system font <3
        * -apple-system, BlinkMacSystemFont: Different ways of matching San Francisco, the default font on MACOS and IOS -- because Apple are prudes and won't just *give users access to the font*
        * Segoe UI: WINDOWS, Vista and above
        * Ubuntu: UBUNTU and several other Linux systems
        * Roboto: ANDROID
        * Cantarell: Several Linux systems, especially those using KDE
        * Helvetica Neue: Used to be the default for MAC OS X
        * Liberation Sans: Several Linux systems
        * Arimo: CHROMEBOOKS
        * Tahoma: WINDOWS, XP or below (although if you're using that in 2021, please seek professional help)
        * Arial: Last resort
        * sans-serif: SUPER last resort
    */
    --system: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Ubuntu, Roboto, Cantarell, 'Helvetica Neue', 'Liberation Sans', Arimo, Tahoma, Arial, sans-serif;

    --sans-serif: "Alegreya Sans MF", "Alegreya Sans", "Source Sans MF", "Source Sans 3", "Source Sans Pro", "Source Sans", var(--system), sans-serif;

    /* EB Garamond is a version of Garamond, a font explicitly designed for print, but... eh, i like it nonetheless. Gives the website an air of bookishness that, say, Georgia wouldn’t.
    If it can't find EB Garamond it cycles through a bunch of close matches. */
    --serif: 'EB Garamond MF', 'EB Garamond MF HellenicNums', 'EB Garamond MF Unicode', 'EB Garamond', Garamond, 'Adobe Garamond', 'URW Palladio L', 'Times New Roman', 'Times', 'Baskerville','Cormorant Garamond', 'Cormorant', serif;

    /* Monospace! Similar principle to `--system`; it tries to find your system's default monospace font.

        * SFMono-Regular, SF Mono: MAC OS
        * Menlo, Monaco: Earlier versions of MAC OS
        * Consolas: WINDOWS
        * Roboto Mono: ANDROID
        * Ubuntu Mono, Oxygen Mono, Liberation Mono: Linux systems
        * Cousine: CHROMEBOOKS
    */
    --monospace: ui-monospace, SFMono-Regular, Consolas, "SF Mono", Menlo, Monaco, "Ubuntu Mono", "Roboto Mono", "Oxygen Mono", "Liberation Mono", "Cousine", monospace;
    
    --typewriter: "Courier Prime", "Courier", "Courier New", "Liberation Mono", "Cousine", monospace;

    /* Cormorant is a display serif. It’s used more often than most other one-time fonts on the site, so i figured i’d give it its own variable. */
    --cormorant: "Cormorant Garamond", var(--serif);
    
    /* Verdana is very useful at small sizes. */
    --verdana: Verdana, Bitstream Vera, Bitstream Vera Sans, Vera, var(--system);
    
    /* Gill Sans, the British Helvetica — nobody ever got fired for picking it. */
    /* Don’t look up Eric Gill on Wikipedia. */
    --gill-sans: "Gill Sans", "Gill Sans MT", "Gill Sans Nova", Lato, var(--sans-serif);
    
    --palatino: "Palatino Linotype", "Palatino", "URW Palladio L", "Book Antiqua", var(--serif);
    
    --helvetica: "Helvetica Now", "Helvetica Neue", "Arial Nova", "Arial", Helvetica, Liberation Sans, Arimo, sans-serif;

    /* Major thirds type scale */
    font-size: 1.225rem;
    
    --type-xxx-large: 3.05rem;
    --type-xx-large: 2.44rem;
    --type-x-large: 1.95rem;
    --type-larger: 1.56rem;
    --type-large: 1.25rem;
    --type-regular: 1rem;
    --type-small: 0.8rem;
    --type-smaller: 0.64rem;
    --type-x-small: 0.512rem;
    
    /* It’s considered good typographical practice to put a bit of space between all-caps and small-caps. Capital letters aren’t really designed to go next to each other; they're designed to go next to lowercase, so this helps give them some breathing room. */
    --caps-spacing: 0.05em;
}

/* Ah, yes, the <body> element. Where it all starts. Not sure why i made this different from `:root`, in hindsight... */
body {

    /* The background colour should be the background colour, and the text colour should be the text colour. Simple stuff. */
    background-color: var(--background);
    color: var(--text);

    /* This defines how the background of the page... works. */

    /* This is kind of intended for pages with a vignette, like `/heraldry`. The vignette will cover the whole page, while the actual "background" will repeat itself. */
    background-size: 100% 100%, auto;
    background-attachment: fixed;
    background-repeat: repeating;

    /* Always annoyed me how the <body> has some margin around it by default. WTF? */
    margin: 0;

    /* TYPOGRAPHY STUFF! */ 

    /* Garamond is the default here. */
    font-family: var(--serif);

    /* This gives the new lines room to breathe, making them easier to read. Source: bro trust me */
    line-height: 1.45;

    /* We're going to be justifying a lot of text, so turn on those hyphens! Chrome tends to be a bit jankier than, say, Firefox, but i think it's finally added proper support for this... Maybe i'm wrong. */
    hyphens: auto;

    /* Have the numbers go up and down like lowercase letters. */
    font-variant-numeric: oldstyle-nums proportional-nums;
}

/* Compatibility! */
@supports not (font-variant-numeric: oldstyle-nums proportional-nums) {
  body { font-feature-settings: "onum" 1, "pnum" 1; }
}

/* The <main> element is where all of the text-y stuff gets put. Most of the pages on my site have one of these. */
main {
    /* Put it in the centre of the page... */
	margin: auto;
    /* ...give it some room to breathe... */
	padding: 2ch;
    /* ...and don't make it too wide. If lines of text are too long, they're harder to read, but a lot of people don't seem to have caught on yet --- looking at you, Wikipedia! */
	max-inline-size: 65ch;
}

/* Text in paragraphs is justified (i.e. spread out to cover both the left and right edges).
   Some people say this is bad for accessibility, but i like it --- it gives the text a more "book-y" look.
*/
p {
    text-align: justify;
    hyphens: auto;
}

/* <figure> elements contain an <img> element with its own styling, so they don't need any padding and margin by default. */
figure {
    padding: 0;
    margin: 0;
}

/* Images! I hate them so much! */
img {
    /* Give them a bit of breathing room on the top and bottom.*/
	margin-block: 1ch;
	margin-inline: auto;

    /* Make them take up a line of their own by default. */
	display: block;

    /* They shouldn't be wider than the element they're contained in. */
	max-inline-size: 100%;
}

/* Headers, headers, headers. */
h1, h2, h3, h4, h5, h6 {

    /* Visually distinguishing them by giving them the accent colour. */
    color: var(--accent);

    /* Since the font size is gonna be bigger, no need to have all that extra space in the line height. */
    line-height: 1.1;
}

h1 {
    /* It’s gonna be at the top of the page, so centring it will make it look more balanced. */
	text-align: center;

    /* Alll the swooshes! This only takes effect in a very particular set of circumstances, sadly.
       It has to be set in EB Garamond, *and in italics* --- vanishingly rare. */
	font-feature-settings: "swsh", "dlig", "clig", "hlig";
}

a {
	color: var(--accent);
	text-decoration: underline 1px;
	text-decoration-style: dotted;
	cursor: pointer;
}

/* Links outside of the site have solid underlines. Links inside of it are dotted. */
a[href^="http"], a[href^="//"], a[href^="mailto:"] {
  text-decoration-style: solid;
}

mark {
  color: var(--text);
  background-color: var(--accent_translucent);
  padding-block: 0.1em;
  padding-inline: 0.25em;
}

.table-container {
    overflow-x: auto;
    max-inline-size: 100%;
}

table {
  border-collapse: collapse;
}

b, strong, th, dt {
  color: var(--accent);
  font-weight: bold;
}

.sentence-case {
  text-transform: capitalize;
}

.allcaps {
  text-transform: uppercase;
  letter-spacing: var(--caps-spacing);
}

.uppercase {
  letter-spacing: var(--caps-spacing);
}

.centre {
	margin-inline: auto;
	display: block;
	text-align: center;
}

code,
pre,
.monospace {
	font-family: var(--typewriter);
}

code:not(pre code) {
    font-size: 0.9em;
}

pre {
    max-width: 100%;
    overflow-x: auto;
}

.serif {
	font-family: var(--serif);
}

.smallcaps {
	font-variant: small-caps;
	letter-spacing: var(--caps-spacing);
}

.all-sc {
  font-variant: all-small-caps;
	letter-spacing: var(--caps-spacing);
}

.c2sc {
    font-feature-settings: "c2sc";
	letter-spacing: var(--caps-spacing);
}

blockquote {
	margin-block: 0.5em;
	font-size: max(0.8em, 0.64rem);
}

blockquote footer {
  font-style: normal;
}

blockquote footer::before {
  content: "—";
}

q {
	font-style: italic;
}

li {
	margin: 0.1em;
}

hr {
  border-color: var(--accent);
}

.accent {
	color: var(--accent);
}

input[type="text"] {
	border: none;
	background-color: transparent;
	font-size: 14pt;
	color: var(--accent);
	font-family: inherit;
	
	padding: 10px;
	border-bottom: 1px solid var(--accent);
	margin: 5px;
}

button {
	padding-inline: 0.5rem;
	border: 1px solid var(--accent);
	background-color: transparent;
	color: var(--accent);
    font-family: inherit;
	
	transition-duration: 0.5s;
	font-size: 1em;
	font-variant-numeric: inherit;
}

button:hover, button:focus {
	cursor: pointer;
}

details {
  border: 1px solid var(--accent);
}

details > :not(summary) {
  padding: 0 1em;
}

summary {
  text-align: center;
  font-weight: bold;
  color: var(--accent);
  padding: 0.5em;
  border-bottom: 1px dotted var(--accent);
  cursor: pointer;
}

sup, sub {
  vertical-align: baseline;
  position: relative;
}
sup {
  top: -0.4em;
}
sub {
  top: 0.4em;
}

.shortinput {
	inline-size: 30px;
}

  main > footer {
    text-align: center;
  }
  
  .tiny, footer small {
    font-size: var(--type-small);
    color: var(--accent);
    font-style: italic;
    text-align: center;
    line-height: 1.1;
  }
  
  /* Breadcrumb navigation, as seen on /words/loanwords */
  .breadcrumbs {
    text-align: center;
    margin-block: 1em;
    margin-inline: 0;
  }
  
  #asciicoa, .asciicoa {
    width: min-content;
    margin: auto;
    font-size: var(--type-small);
    color: var(--accent);
    font-variant-ligatures: none;
    line-height: 1.1;
  }
  
  .flag {
    display: inline-block;
    margin: 0;
    block-size: 1.25ex;
    max-inline-size: none;
    border: 1px solid var(--text);
  }
  
  .flag.irregular {
      border: none;
      filter: drop-shadow(0 1px var(--text)) drop-shadow(0 -1px var(--text)) drop-shadow(1px 0 var(--text)) drop-shadow(-1px 0 var(--text));
  }
  
  .theonym {
    font-style: normal;
    font-variant: small-caps;
    letter-spacing: var(--caps-spacing);
  }
  
  u.overline, .overline, .gnum {
    text-decoration: overline;
  }
  
  /* Used to style passages consisting only of numbers. */
  .numbers {
    font-variant-numeric: normal;
  }
  
  nav.languages {
    margin-inline: auto;
    margin-block-end: 1rem;
  }
  
  nav.languages ul {
    margin: auto;
    padding: 0;
    text-align: center;
    margin-block-start: 0.5em;
  }
  
  nav.languages li {
    display: inline-block;
    margin-block: 0;
    margin-inline: 0.5em;
  }
  
  /* UNDER CONSTRUCTION sign for pages that are, well, under construction */
  
  .under-construction {
    background-color: #FDD835;
    color: #000E;
    
    padding: .5rem 1rem;
    font-style: italic;
    margin-block: 1rem;
    margin-inline: 0;
  }
  
  .under-construction > strong {
    font-size: var(--type-larger);
    color: inherit;
  }
  
  .visually-hidden, .sr-only {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}