body {
  background: red;
}

.styled {
  background: pink;
}

.reader {
  background: white;
}

/* ===========================================
                      RESET
   ===========================================*/

/* Basic Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===========================================
                     LAYOUT
   ===========================================*/
body {
  display: grid;
}

body.styled {
  grid-template-columns: 160px 1fr 160px;
  grid-template-areas:
    "skip skip skip"
    "header header header"
    "nav main aside"
    "footer footer footer";
  gap: 0;
}

body.reader {
  grid-template-columns: 250px 1fr;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "skip skip"
    "nav header"
    "nav controls"
    "nav main"
    "nav aside"
    "footer footer";
  min-height: 100vh;
}

body.reader .page-article {
  grid-template-columns: 2fr 1fr;
  grid-template-rows:60px auto 20px;
  grid-template-areas:
    "skip  skip"
    "header header"
    "main aside"
    "footer footer";
}

/* Assign grid areas to elements */
header {
  grid-area: header;
}

nav {
  grid-area: nav;
}

.reader [aria-hidden=true] {
  display: none;
}

main {
  grid-area: main;
}

aside {
  grid-area: aside;
}

footer {
  grid-area: footer;
}

.reader-controls {
  grid-area: controls;
}

.skip-link {
  grid-area: skip;
}

/* ===========================================
            ACCESSIBILITY ELEMENTS
   ===========================================*/

/* Basic body - AAA requires 18px+ for body text */
body.reader {
  font-family: Charter, 'Bitstream Charter', 'Sitka Text', Cambria, serif;
  font-size: 19px;
  line-height: 1.6; /* AAA requires 1.5 minimum */
  padding: 1rem;
  color: #1a1a1a; /* Blackish text - easier for eye strain */
  background: #fffff8; /* Whiteish background - easier for eye strain */
  
}

/* Headings  */
body.reader h1 {
  font-size: 2.5em;
  line-height: 1.2;
  margin-bottom: 0.5em;
}

body.reader h2 {
  margin-top: 1.5em; 
  font-size: 1.75em;
    margin-bottom: 0.4em;
}
h3 { font-size: 1.25em; margin-bottom: 0.3em; }

/* Paragraphs and links */

body.reader p {
    margin-bottom: 1.2em;
    max-width: 80ch; /* AAA recommends max 80 characters per line */
}

body.reader a {
  color: #0051a5; 
}

body.reader a:hover {
  background: #1a1a1a;
  color: #fffff8;
}

/* Lists */
ul, ol {
  margin-left: 2em;
  margin-bottom: 1em;
}

/* Buttons */
button {
  font-size: 18px;
  padding: 0.5em 1em;
  background: #000;
  color: #fff;
  border: 2px solid #000;
  cursor: pointer;
}

button:hover {
  background: #333;
}

/* ===========================================
              READER CONTROLS
   ===========================================*/

.reader-controls {
   display: flex;
   gap: 1rem;
   padding: 1rem;
}

body.reader .reader-control-button, body.reader .reader-control-button button {
  font-family: Charter, 'Bitstream Charter', 'Sitka Text', Cambria, serif;
   padding: 0.5em 1em;
   background: #333;
   color: white;
   border: none;
   border-radius: 4px;
   text-decoration: none;
   cursor: pointer;
   font-size: 1rem;
}

.reader-control-button:hover,
.reader-control-button:focus {
   background: #555;
}

/* === Hide and Display in Reader Mode === */

/* Hide the reader mode toggle button when in reader mode */
body.reader header button[aria-label="Reader mode"] {
   display: none;
}

/* In reader mode, hide nav but keep space */
body.reader > nav {
  opacity: 0;
  pointer-events: none;
  background: #f5f5f0;
  padding: 0.5rem;
  margin: 0.5rem;
}

/* Show on focus for keyboard users */
body.reader nav:focus-within {
  opacity: 1;
  pointer-events: auto;
}

/* Show when show-nav class is active */
body.reader.show-nav nav {
  opacity: 1;
  pointer-events: auto;
}

/* ===========================================
              ACCESSIBLE LINKS
   ===========================================*/

/* Links - 7:1 contrast required for AAA */
a {
  color: #0000EE; /* Standard blue - close to 7:1 */
  text-decoration: underline;
}

a:hover {
  background: #000; /* Black background */
  color: #fff; /* White text - maximum contrast */
}

/* CRITICAL: Focus indicators for keyboard users */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid #0066cc;
  outline-offset: 3px; /* AAA recommends 2px minimum */
}

/* Remove focus on mouse click, keep for keyboard */
*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 3px solid #0066cc;
  outline-offset: 3px;
}

/* Visually hide skip link but keep it accessible */
.skip-link {
   position: absolute;
   left: -10000px;
   top: auto;
   width: 1px;
   height: 1px;
   overflow: hidden;
}

/* Show skip link when it receives keyboard focus */
.skip-link:focus {
   position: static;
   width: auto;
   height: auto;
   overflow: visible;
}

/* ===========================================
   ===========================================
   
              STYLED VERSION
              
   ===========================================
   ===========================================*/
   
.styled [data-lucide] {
  width: 14px;
  height: 14px;
  display: inline;
  vertical-align: middle;
  stroke-width: 1;
}

.styled .big [data-lucide] {
  width: 25px;
  height: 25px;
  display:inline;
  vertical-align: middle;
  stroke-width: 2;
}

.styled h2 [data-lucide] {
  stroke-width: 2;
}


.styled {
  /* Purple scale */
/* old values
  --color-darkest: #4a148c;
  --color-dark: #6a1b9a;
  --color-medium: #7e57c2;
  --color-light: #b39ddb;
  --color-lighter: #d1c4e9;
  --color-pale: #CCBEE7;
 */
  
  --color-darkest: hsl(270, 70%, 25%);
  --color-dark: hsl(270, 70%, 35%);
  --color-medium: hsl(270, 55%, 55%);
  --color-light: hsl(270, 55%, 70%);
  --color-lighter: hsl(270, 50%, 85%);
  --color-pale: hsl(270, 40%, 88%);
  
  /* Backgrounds */
  --bg-body: var(--color-pale);
  --bg-white: white;
  
  /* Borders */
  --border-primary: var(--color-light);
  --border-secondary: var(--color-lighter);

  
  /* Text Colors */
  --text-primary: var(--color-darkest);
}

body.styled {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-weight: 300;
  font-size: 12px;
  color: var(--text-primary);
  background-color: var(--bg-body);
  padding: 0;
}

.styled h2 {
  display: flex;           
  align-items: center;     
  gap: 6px;                
  padding: 2px 4px;
  background: linear-gradient(to top, var(--color-pale), var(--bg-white));
  border-bottom: 2px solid var(--border-primary);
  font-weight: 400;
  font-size: 14px;
  margin:0;
}

.styled p {
  margin: 2px 4px 12px 6px;
  max-width: none;
}

.styled section p:last-child {
  margin-bottom: 4px; 
}

.styled .logfeed p {
  margin: 2px 4px;
}

.styled ul {
  list-style: none;
  padding: 0;
  margin:0;
}

.styled a {
  display: flex;           
  align-items: center;     
  gap: 6px;                
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-secondary);
  padding: 2px 4px;
}
  
.styled a:hover {
  background: var(--border-secondary);
}

.styled a.unavailable, .reader a.unavailable {
  background: hsl(0, 0%, 90%);
  color: hsl(0, 0%, 10%);
  cursor: not-allowed;
}

.styled a.unavailable:hover, .reader a.unavailable:hover {
  background: hsl(0, 0%, 90%);
}

.styled a.no-click, .reader a.no-click {
  pointer-events: none;
  text-decoration: none;
  color: var(--text-primary);
}

.styled a.no-click:hover, .reader a.no-click:hover {
  background: none;
  color: var(--text-primary);
}

.styled table {
  padding: 2px 4px;
    text-align: left;
}

.styled th, .styled td {
  padding: 2px 4px;
}
  
body.styled > header {
  background: linear-gradient(to bottom, var(--color-dark), var(--color-darkest));
  color: white;
  border-bottom: 2px solid var(--border-primary);
  padding: 2px 4px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

body.styled > header div {
  display: flex;
  flex-direction: column;
  gap: 0;
}

body.styled > header h1 {
  padding: 0;
  margin: 0;
}

body.styled > header p {
  font-style: italic;
  padding: 0 0 0 6px;
  margin: 0;
}

body.styled > header button {
  background: none;
  border: 0;
}

body.styled > nav {
  background: white;
  border-right: 2px solid var(--border-primary);
  padding: 0;
  margin: 0;
}

body.styled .breadcrumbs h2 {
  background: linear-gradient(to top, var(--color-medium), var(--border-primary));
  color: white;
}

body.styled > main {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  padding: 20px;
}

.styled .card-deck {
  color: var(--color-darkest);
  font-size: 14px;
  font-weight: 400;
}

.styled .card-deck h2 {
  font-size: 16px;
  font-weight: 500;
}

/* Article: Main Content */
.styled.page-article main {
  padding: 0;
  display: flex;
  gap: 0;
}

.styled.page-article main article {
  background: white;
  color: black;
  font-size: 16px;
  font-weight: 400;
  border: 2px solid var(--border-primary);
  margin: 20px;
  flex: 1;
}

.styled.page-article main article header {
  background: linear-gradient(to top, var(--color-pale), var(--bg-white));
  padding: 2px 4px;
  border-bottom: 1px solid var(--border-primary);
}

.styled.page-article main article header h1 {
  text-align: center;
}

.styled.page-article main article header p {
  text-align: right;
}

.styled.page-article main article p {
  padding: 8px 20px;
}

.styled.page-article main article h2 {
  padding: 16px 20px 8px 20px;
  border-bottom: 1px solid var(--border-secondary);
  background: none;
  border-top: 0;
}

/* Article: Right Aside - Marginalia */
.styled.page-article aside {
  position: relative;
  background-color: var(--bg-body);
  border-left: 0;
  padding: 0 4px;
  margin: 20px 25px 20px 0;
}

.styled .marginalia {
  background: white;
  border: 2px solid var(--border-primary);
  padding: 0;
  margin-bottom: 8px;
}

.styled .marginalia h2 {
  font-size: 12px;
  margin: 0;
  padding: 2px 4px;
}

.styled .marginalia ul {
  padding: 0;
  margin: 0;
}

.styled .marginalia li {
  margin: 0;
}

.styled .marginalia li a {
  display: block;
  font-size: 12px;
  padding: 2px 4px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border-secondary);
}

.styled .marginalia li:last-child a {
  border-bottom: 0;
}

.styled main > section, .styled main > article {
  background: white;
  border: 2px solid var(--border-primary);
}

body.styled.page-article main > article {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
}

body.styled.page-article .internal-nav-bar {
  grid-column: 1;
  position: sticky;
  top: 20px; /* Sticks when scrolling */
  align-self: start;
}

body.styled.page-article .article-text {
  grid-column: 2;
  max-width: none;
}

.styled .card-text {
  list-style: disc;
}

.styled .card-text a {
  display: inline;
  padding: 0;
}

.wide {
  grid-column: span 2;
}

.full {
  grid-column: span 3;
}

body.styled > aside {
  background: white;
  border-left: 2px solid var(--border-primary);
}

.styled .logfeed {
  max-height: 350px;
  overflow: auto;
}

.styled .logfeed time {
  display: block;
  font-weight: 500;
  font-size: 12px;
  background: linear-gradient(to bottom, var(--color-pale), var(--bg-white));
  padding: 2px 4px;
}

.styled .logfeed article {
  border-bottom: 1px solid var(--border-secondary);
}

.styled .logfeed a {
  display: inline;
  padding: 0;
}

body.styled > footer {
  background: var(--border-secondary);
  border-top: 2px solid var(--border-primary);
  padding: 2px 4px;
  display: flex;
  flex-direction: row;
  justify-content: space-between; 
}

/* ===========================================
              STYLED "CATEGORY"
   ===========================================*/
   
.styled.category {
  /* Blue scale */
  --color-darkest:   hsl(210, 70%, 25%);
  --color-dark:      hsl(210, 70%, 35%);
  --color-medium:    hsl(210, 55%, 55%);
  --color-light:     hsl(210, 55%, 70%);
  --color-lighter:  hsl(210, 50%, 85%);
  --color-pale:      hsl(210, 40%, 88%);
}

/* ===========================================
              STYLED "SATIRE"
   ===========================================*/

.styled.satire {
  --color-darkest: hsl(350, 70%, 25%);
  --color-dark: hsl(350, 70%, 35%);
  --color-medium: hsl(350, 55%, 55%);
  --color-light: hsl(350, 55%, 70%);
  --color-lighter: hsl(350, 50%, 85%);
  --color-pale: hsl(350, 40%, 88%);
}

/* ===========================================
   ===========================================
   
                MEDIA QUERIES
              
   ===========================================
   ===========================================*/
   
   
   
/* ===========================================
                  MOBILE
   ===========================================*/

@media (max-width: 768px) {
  
  /* Regular Mobile */
  
  body.styled {
    grid-template-columns: 1fr;
    grid-template-areas:
      "skip"
      "header"
      "main"
      "aside"
      "footer"
      "nav";
    padding: 0;
    margin: 0;
  }
  
    body.styled > nav, body.reader > nav {
    display: block;
    opacity: 1;
  }
  
  /* Styled Mobile */
  
  /* Single column grid for main content */
  body.styled > main {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
  
  /* Wide and full items take up only 1 column */
  .wide, .full {
    grid-column: span 1;
  }
  
  /* Reader Mobile */
  
  body.reader {
    grid-template-columns: 1fr;
    grid-template-areas:
      "skip"
      "header"
      "controls"
      "main"
      "aside"
      "footer"
      "nav";
    padding: 0;
    margin: 0;
  }
  
  body.reader {
    padding: 1rem;
  }
  
  body.reader > footer {
    display: block;
    align-items: center;
  }
  

}

