/* =========================================================
   style.css — DSA-inspired theme for org-mode static export
   Pure CSS, no JavaScript.
   ========================================================= */

:root {
  /* Official DSA Design Guide palette:
     https://design.dsausa.org/national-identity/color-palette/ */

  /* DSA Red + tints */
  --dsa-red:        #EC1F27;
  --dsa-red-tint1:  #F04C53;
  --dsa-red-tint2:  #F4797E;
  --dsa-red-tint3:  #F7A5A9;
  --dsa-red-tint4:  #FBD2D4;

  /* DSA Black + tints */
  --dsa-black:      #231F20;
  --dsa-black-tint1: #3B3838;
  --dsa-black-tint2: #605C5C;
  --dsa-black-tint3: #8C8989;
  --dsa-black-tint4: #C1C0BF;

  --dsa-white:      #ffffff;

  /* Not in the official palette — a manual shade used only for
     hover/active states, since the guide provides no darker red. */
  --dsa-red-dark:   #C21A21;

  /* Semantic aliases used throughout this file */
  --dsa-ink:        var(--dsa-black);
  --dsa-gray:       var(--dsa-black-tint2);
  --dsa-light-gray: #f4f4f4; /* neutral off-white, not brand-specified */
  --dsa-border:     var(--dsa-black-tint4);

  /* Lighter surface for header/footer/table-header bands, so they
     read as dark-but-soft rather than harsh near-black. Still uses
     an official DSA Black tint, just a step lighter. */
  --dsa-panel:      var(--dsa-black);
  --dsa-panel-text: var(--dsa-black-tint4);

  --font-heading: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
  --max-width: 1100px;
}

/* -------------------- Reset / base -------------------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--dsa-ink);
  background: var(--dsa-white);
  line-height: 1.6;
  font-size: 17px;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--dsa-red);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--dsa-black);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 { font-size: 2.4rem; margin: 0.4em 0 0.5em; }
h2 { font-size: 1.8rem; margin: 1.2em 0 0.5em; }
h3 { font-size: 1.3rem; margin: 1em 0 0.4em; }

p { margin: 0 0 1em; }

hr {
  border: none;
  border-top: 3px solid var(--dsa-red);
  width: 60px;
  margin: 2.5em 0;
}

/* -------------------- Page shell -------------------- */
/* org-mode wraps content in #content and #postamble/#preamble */

#preamble {
  background: var(--dsa-panel);
  border-bottom: 5px solid var(--dsa-red);
}

#content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 60px;
}

#postamble {
  background: var(--dsa-panel);
  color: var(--dsa-black-tint4);
  margin-top: 60px;
}

/* -------------------- Top nav (preamble) -------------------- */
/* The elisp org-html-preamble-format renders a pipe-delimited nav.
   This turns it into a horizontal pill-style bar like dsausa.org's header. */

#preamble {
  padding: 0;
}

#preamble p {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

#preamble a {
  color: var(--dsa-white);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.15s ease;
}

#preamble a:hover {
  background: var(--dsa-red);
  text-decoration: none;
}

/* First nav link acts as the "logo" / home link — make it stand out */
#preamble a:first-child {
  color: var(--dsa-red);
  font-size: 1.1rem;
  padding-left: 1;
  margin-right: auto;
}
#preamble a:first-child:hover { background: none; text-decoration: underline; }

/* A dedicated "Donate"-style CTA — target the last pill in the nav */
#preamble a:last-of-type {
  background: var(--dsa-red);
  color: var(--dsa-white);
  margin-left: 8px;
}
#preamble a:last-of-type:hover { background: var(--dsa-red-dark); }

/* -------------------- Title block -------------------- */
.title, h1.title, #content > h1 {
  border-bottom: none;
}

/* -------------------- Table of contents -------------------- */
#table-of-contents {
  background: var(--dsa-light-gray);
  border-left: 4px solid var(--dsa-red);
  padding: 20px 28px;
  margin: 2em 0;
  border-radius: 4px;
}
#table-of-contents h2 {
  margin-top: 0;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#table-of-contents ul {
  list-style: none;
  padding-left: 0;
}
#table-of-contents ul ul { padding-left: 1.2em; }
#table-of-contents li { margin: 0.3em 0; }
#table-of-contents a {
  color: var(--dsa-ink);
  font-weight: 600;
}
#table-of-contents a:hover { color: var(--dsa-red); }

/* -------------------- Sections -------------------- */
.outline-2, .outline-3 {
  margin-bottom: 1.5em;
}

/* -------------------- Rose bullet accents (DSA signature 🌹) -------------------- */
#content ul:not(#table-of-contents ul) {
  list-style: none;
  padding-left: 0.2em;
}
#content ul:not(#table-of-contents ul) li {
  position: relative;
  padding-left: 1.6em;
  margin-bottom: 0.6em;
}
#content ul:not(#table-of-contents ul) li::before {
  content: "\1F339"; /* 🌹 */
  position: absolute;
  left: 0;
  top: 0.05em;
  font-size: 0.9em;
}

#content ol {
  padding-left: 1.4em;
}

/* -------------------- Buttons / CTA links -------------------- */
.button, a.button, .cta {
  display: inline-block;
  background: var(--dsa-red);
  color: var(--dsa-white) !important;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  padding: 12px 28px;
  border-radius: 999px;
  text-decoration: none !important;
  margin: 0.4em 0.4em 0.4em 0;
  transition: background 0.15s ease;
}
.button:hover, a.button:hover, .cta:hover {
  background: var(--dsa-red-dark);
}

/* -------------------- Card grid --------------------
   Wrap a set of images/links in a <div class="card-grid"> in your
   org file with #+BEGIN_EXPORT html / #+END_EXPORT to reproduce
   the DSA "Get Involved" image-tile layout. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 2em 0;
}
.card-grid a {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card-grid a:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
  text-decoration: none;
}
.card-grid img { width: 100%; display: block; }

/* -------------------- Blockquotes -------------------- */
blockquote {
  border-left: 4px solid var(--dsa-red);
  margin: 1.5em 0;
  padding: 0.5em 0 0.5em 1.2em;
  color: var(--dsa-gray);
  font-style: italic;
}

/* -------------------- Tables -------------------- */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
}
th, td {
  border: 1px solid var(--dsa-border);
  padding: 10px 14px;
  text-align: left;
}
th {
  background: var(--dsa-black);
  color: var(--dsa-white);
  font-family: var(--font-heading);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}
tr:nth-child(even) td { background: var(--dsa-light-gray); }

/* -------------------- Code blocks -------------------- */
pre, pre.src {
  background: #f7f7f7;
  border: 1px solid var(--dsa-border);
  border-left: 4px solid var(--dsa-red);
  border-radius: 4px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 0.9rem;
}
code { background: var(--dsa-light-gray); padding: 2px 5px; border-radius: 3px; }

/* -------------------- Footer (postamble) -------------------- */
#postamble {
  padding: 40px 24px 30px;
}
#postamble .content, #postamble p {
  max-width: var(--max-width);
  margin: 0 auto;
  font-size: 0.85rem;
}
#postamble a { color: var(--dsa-white); font-weight: 600; }
#postamble a:hover { color: var(--dsa-red); }

/* -------------------- Responsive -------------------- */
@media (max-width: 640px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  #preamble p {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
  }
  #preamble a {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 14px 16px;
    font-size: 0.9rem;
    border-radius: 0;
    text-align: left;
    border-bottom: 1px solid var(--dsa-black-tint3);
  }
  #preamble a:first-child {
    font-size: 1.15rem;
    color: var(--dsa-red);
    padding: 18px 16px 14px;
    margin: 0;
  }
  #preamble a:last-of-type {
    background: var(--dsa-red);
    color: var(--dsa-white);
    text-align: center;
    margin: 4px 0 0;
    padding: 16px;
    border-bottom: none;
  }
}




/* =========================================================
   Calendar (pure CSS, no JavaScript)
   ---------------------------------------------------------
   Each month is an ordinary top-level org headline — no HTML
   needed for the structure at all:

     * July 2026
     :PROPERTIES:
     :CUSTOM_ID: cal-2026-07
     :HTML_CONTAINER_CLASS: cal-panel
     :END:

     [[#cal-2026-08][Next month →]]

     #+ATTR_HTML: :class cal-events
     - Jul 15 (Tue) :: *Chapter Meeting* --- 6:30 PM, Community Center

   :CUSTOM_ID: gives the headline a stable anchor id. Org's
   :HTML_CONTAINER_CLASS: property adds "cal-panel" to the
   <div> org already wraps around every headline, so no manual
   markup is required. Prev/Next are just ordinary org links
   pointing at those ids. The event list is a normal org
   description list (`term :: description`), tagged with the
   cal-events class via #+ATTR_HTML.

   HOW THE SHOW/HIDE WORKS
   CSS :target shows whichever month's link was clicked.
   :has() supplies the default (show the first month) whenever
   nothing is targeted yet — so there's no "checked" attribute
   or per-month rule to maintain, and no limit on how many
   months you can add. This relies on :has(), which is
   supported in all current major browsers.

   HOW TO ADD A MONTH
   Add another headline like the one above, in order, with a
   unique CUSTOM_ID. Update the neighboring months' Prev/Next
   links to point to it.

   HOW TO ADD AN EVENT
   Add another `term :: description` line to that month's list.
   Nothing else needs to change.
   ========================================================= */

.cal-panel {
  display: none;
  background: var(--dsa-light-gray);
  border-radius: 8px;
  padding: 24px 28px;
  margin-bottom: 1.5em;
}

.cal-panel:has(> h2:target) {
  display: block;
}

/* Default: show the first month whenever no month is targeted */
html:not(:has(.cal-panel h2:target)) .cal-panel:first-of-type {
  display: block;
}

.cal-panel {
  position: relative;
  padding-top: 56px;
}

.cal-panel h2 {
  text-align: center;
  margin-top: 0;
}

/* Prev/Next — two independent paragraphs, each tagged via:
     #+ATTR_HTML: :class cal-prev
     [[#id][← Prev]]
   and
     #+ATTR_HTML: :class cal-next
     [[#id][Next month →]]
   Anchoring each to its own corner (rather than using
   justify-content: space-between on one shared paragraph)
   means either one can be safely omitted — e.g. the first
   month has no Prev, the last has no Next — without throwing
   off the other's position. */
.cal-panel p.cal-prev,
.cal-panel p.cal-next {
  position: absolute;
  top: 22px;
  margin: 0;
}
.cal-panel p.cal-prev { left: 28px; }
.cal-panel p.cal-next { right: 28px; }

.cal-panel p.cal-prev a,
.cal-panel p.cal-next a {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--dsa-red);
  padding: 7px 16px;
  border: 2px solid var(--dsa-red);
  border-radius: 999px;
  text-decoration: none;
}
.cal-panel p.cal-prev a:hover,
.cal-panel p.cal-next a:hover {
  background: var(--dsa-red);
  color: var(--dsa-white);
}

/* Event list — a plain org description list, classed via
   #+ATTR_HTML: :class cal-events */
dl.cal-events {
  margin: 0;
}
dl.cal-events dt {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--dsa-red);
  margin-top: 0.9em;
}
dl.cal-events dt:first-child {
  margin-top: 0;
}
dl.cal-events dd {
  margin: 0.2em 0 0;
  color: var(--dsa-gray);
  padding-bottom: 0.7em;
  border-bottom: 1px solid var(--dsa-border);
}
dl.cal-events dd:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Optional empty-state paragraph:
   #+ATTR_HTML: :class cal-empty
   No events scheduled yet. */
.cal-panel p.cal-empty {
  color: var(--dsa-gray);
  font-style: italic;
  margin: 0;
  text-align: left;
}

@media (max-width: 640px) {
  .cal-panel {
    /* undo the desktop corner-pinning clearance — buttons flow
       normally below the heading on narrow screens instead */
    padding: 20px 16px;
    text-align: center;
  }

  .cal-panel p.cal-prev,
  .cal-panel p.cal-next {
    position: static;
    display: inline-block;
    margin: 0 4px 12px;
  }

  .cal-panel p.cal-prev a,
  .cal-panel p.cal-next a {
    font-size: 0.72rem;
    padding: 6px 14px;
  }

  /* .cal-panel is centered above for the nav row; put the event
     list back to normal left alignment */
  .cal-panel dl.cal-events,
  .cal-panel p.cal-empty {
    text-align: left;
  }
}
