/* Base Reset */
@import url('components/dropdowns.css');

/* ===================================
   FULL-WIDTH HEADER & FOOTER
   (edge-to-edge background)
=================================== */
header,
footer {
  width: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--color-background);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

header .top-bar,
footer .bottom-bar {
  max-width: 960px;
  margin: 0 auto;
  padding: 5px 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Ensure main content doesn't get hidden behind fixed header */
main.quote-wrapper {
  padding-top: 20px;
  padding-bottom: 20px;
}


:root {
  /* ===================================
     CORE DESIGN TOKENS
     These are the base tokens that define the design system
  =================================== */
  
  /* Color System */
  --color-primary: #1a73e8;
  --color-primary-dark: #1557b0;
  --color-secondary: #ff7043;
  --color-secondary-dark: #e65100;
  
  /* Neutral Colors */
  --color-white: #ffffff;
  --color-gray-100: #f8f9fa;
  --color-gray-200: #e9ecef;
  --color-gray-300: #dee2e6;
  --color-gray-400: #ced4da;
  --color-gray-500: #adb5bd;
  --color-gray-600: #6c757d;
  --color-gray-700: #495057;
  --color-gray-800: #343a40;
  --color-gray-900: #212529;
  --color-black: #000000;
  
  /* Semantic Colors */
  --color-success: #28a745;
  --color-warning: #ffc107;
  --color-danger: #dc3545;
  --color-info: #17a2b8;
  
  /* Typography */
  --font-family-base: 'Helvetica Neue', Arial, sans-serif;
  --font-family-serif: Georgia, 'Times New Roman', Times, serif;
  --font-family-heading: var(--font-family-base);
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;
  
  /* Spacing */
  --spacing-unit: 4px;
  --spacing-xxs: calc(var(--spacing-unit) * 1);  /* 4px */
  --spacing-xs: calc(var(--spacing-unit) * 2);   /* 8px */
  --spacing-sm: calc(var(--spacing-unit) * 3);   /* 12px */
  --spacing-md: calc(var(--spacing-unit) * 4);   /* 16px */
  --spacing-lg: calc(var(--spacing-unit) * 6);   /* 24px */
  --spacing-xl: calc(var(--spacing-unit) * 8);   /* 32px */
  --spacing-xxl: calc(var(--spacing-unit) * 12); /* 48px */
  
  /* Border Radius */
  --border-radius-sm: 4px;
  --border-radius-md: 6px;
  --border-radius-lg: 8px;
  --border-radius-full: 9999px;
  
  /* Dropdown Specific */
  --dropdown-bg: var(--color-white);
  --dropdown-text: var(--color-gray-900);
  --dropdown-border: var(--color-gray-200);
  --dropdown-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --dropdown-hover-bg: var(--color-gray-100);
  --dropdown-hover-text: var(--color-primary);
  --dropdown-active-bg: var(--color-gray-200);
  --dropdown-divider: var(--color-gray-200);
  --dropdown-min-width: 200px;
  --dropdown-padding: var(--spacing-sm) 0;
  --dropdown-item-padding: var(--spacing-sm) var(--spacing-md);
  --dropdown-z-index: 1000;
  
  /* Toast Notifications */
  --toast-bg: var(--color-gray-900);
  --toast-text: var(--color-white);
  --toast-success-bg: var(--color-success);
  --toast-success-text: var(--color-white);
  --toast-error-bg: var(--color-danger);
  --toast-error-text: var(--color-white);
  --toast-warning-bg: var(--color-warning);
  --toast-warning-text: var(--color-gray-900);
  --toast-info-bg: var(--color-info);
  --toast-info-text: var(--color-white);
  --toast-z-index: 9999;
  
  /* Breakpoints */
  --breakpoint-xs: 480px;
  --breakpoint-sm: 768px;
  --breakpoint-md: 1024px;
  --breakpoint-lg: 1280px;
  --breakpoint-xl: 1440px;

  /* Existing Values */
  --color-background: #ffffff;         /* theme-template.css:7 */
  --color-text: #333;                  /* theme-template.css:8 */
  --color-blockquote: #2c3e50;
  --color-meta-border: #34495e;
  --color-btn-border: #ccc;
  --color-btn-bg-hover: #f3f3f3;
  --color-btn-hover: #111;
  --color-link: #555;
  --color-like-hover: #e74c3c;
  --font-family-base: 'Helvetica Neue', sans-serif;
  --font-family-serif: Georgia, serif;
  --font-size-base: 16px;
  --font-size-blockquote: 2.5rem;
  --font-size-blockquote-mobile: 1.8rem;
  --font-size-meta: 1rem;
  --font-size-btn: 0.9rem;
  --font-size-export: 36px;
  /* On-page quote sizing (variable) */
  --page-quote-min-size: 3rem;
  --page-quote-pref-size: 7vw;
  --page-quote-max-size: 4.8rem;
  --export-quote-margin-bottom: 30px;
  --export-text-size: 36px; /* same as --font-size-export by default */
  --export-text-line-height: 1.4;
  --export-author-size: 28px;
  --export-source-size: 20px;
  --export-url-size: 20px;
  --export-url-color: #666;
  --spacing-bar-padding: 6px 14px;
  --spacing-bar-padding-lg: 12px 20px;
  --spacing-meta-gap: 20px;
  --spacing-main-padding: 20px;
  --spacing-export-padding: 60px;
  --radius-btn: 5px;
}

/* Mobile quote sizing (phones ≤600px) */
@media screen and (max-width: 600px) {
  :root {
    /* Make quotes larger between 481–600px as well */
    --page-quote-min-size: 1.9rem;
    --page-quote-pref-size: 8.5vw;
    --page-quote-max-size: 3.2rem;
  }

  figcaption.quote-meta { padding-top: 10px; }

  /* Slightly tighter leading to accommodate the larger type */
  .quote__text,
  #quoteText {
    line-height: 1.34;
    margin-bottom: 18px;
  }
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-family-base);
  /* Subtle gradient layered over base background color */
  background-color: var(--color-background);
  background-image: linear-gradient(180deg, rgba(200, 200, 200, 0.872), rgba(0, 0, 0, 0) 65%);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Dropdowns */
.has-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 3000;
  display: none;
  min-width: 200px;
  margin: 4px 0 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  pointer-events: auto;
}

.dropdown-menu.is-open { display: block; }

.dropdown-menu li {
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.dropdown-menu li:hover {
  background: var(--color-btn-bg-hover);
}

/* Utility */
.hidden { display: none !important; }

/* Top & Bottom Bars */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: var(--spacing-bar-padding);
  font-size: var(--font-size-base);
  border-bottom: 1px solid #eee;
  background: #fff;
}

.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: var(--spacing-bar-padding-lg);
  font-size: var(--font-size-base);
  border-bottom: 1px solid #eee;
  background: #fff;
}

.bottom-bar {
  border-top: 1px solid #eee;
  border-bottom: none;
  margin-top: auto;
}

/* Main Content Area */
main.quote-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--spacing-main-padding);
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  text-align: center;
}

/* Blockquote Styling */
/* Reset default browser margins on blockquote */
blockquote,
#quoteContainer,
.quote {
  margin: 0;
  padding: 0;
  border: none;
}

/* Center quote content */
#quoteContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Ensure the info icon doesn't push the quote down */
.quote-container {
  position: relative;
  width: 100%;
}

.info-icon {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 16px;
  opacity: 0.7;
}

.info-icon:hover { opacity: 1; }

.explanation-bubble {
  display: none; /* shown via JS */
  position: absolute;
  top: -8px;
  right: 24px;
  max-width: 80vw;
  background: #fff;
  color: var(--color-text);
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 2000;
}

.quote__text,
#quoteText {
  font-size: clamp(var(--page-quote-min-size), var(--page-quote-pref-size), var(--page-quote-max-size));
  font-weight: bold;
  font-style: italic;
  margin: 0 0 20px 0;
  line-height: 1.4;
  word-break: break-word;
  color: var(--color-blockquote);
}

/* Quote Metadata (Figcaption) */
figcaption.quote-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-meta-gap);
  width: 100%;
  border-top: 2px solid var(--color-meta-border);
  padding-top: 15px;
  font-size: var(--font-size-meta);
  flex-wrap: wrap;
}

/* Actions (Like/Share Buttons) */
.actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-meta-gap);
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-meta-border);
  font-size: var(--font-size-btn);
  font-weight: 600;
  transition: color 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover {
  color: var(--color-like-hover); /* Red for like hover */
  transform: scale(1.05);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}

/* Attribution (Source & Author) */
.attribution {
  text-align: right;
  line-height: 1.5;
}

.attribution__source {
  font-style: italic;
  opacity: 0.8;
}

.attribution__author {
  font-weight: bold;
  display: block;
  margin-top: 4px;
  color: var(--color-blockquote);
}

/* Responsive Tweaks */
@media screen and (max-width: 600px) {
  figcaption.quote-meta {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--spacing-meta-gap);
  }

  .attribution {
    text-align: center;
  }
}

/* Mobile-first responsive enhancements */
@media screen and (max-width: 768px) {
  /* Reduce general paddings via variables */
  :root {
    --spacing-main-padding: 16px;
    --spacing-bar-padding: 8px 12px;
    --spacing-bar-padding-lg: 10px 14px;
    --spacing-meta-gap: 2px;
  }

  /* Stack and center bar contents */
  .top-bar, .bottom-bar { gap: 4px; }
  .top-bar .left,
  .top-bar .right,
  .bottom-bar .left,
  .bottom-bar .right {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Constrain dropdown width on mobile/tablet */
  .dropdown-menu {
    max-width: 90vw;
    overflow-wrap: anywhere;
    right: 0;
    left: auto;
  }
}

@media screen and (max-width: 480px) {
  /* Fine-tune quote scaling via variables for small phones */
  :root {
    --page-quote-min-size: 2.0rem;   /* larger minimum */
    --page-quote-pref-size: 9.8vw;   /* stronger scaling */
    --page-quote-max-size: 4.0rem;   /* higher cap */
    --spacing-main-padding: 10px;
    --spacing-bar-padding: 5px 7px;
    --spacing-bar-padding-lg: 6px 8px;
  }

  /* Tighter leading to accommodate larger text */
  .quote__text,
  #quoteText {
    line-height: 1.32;
    margin-bottom: 16px;
  }

  /* Tighter buttons and actions on small phones */
  .header-btn, .footer-btn {
    padding: 3px 6px;
    margin: 1px;
    font-size: 0.82rem;
  }

  .actions { gap: 2px; }
  .icon-btn { font-size: 0.8rem; }
  .icon-btn svg { width: 16px; height: 16px; }

  .top-bar, .bottom-bar { gap: 0; }
  .top-bar .left,
  .top-bar .right,
  .bottom-bar .left,
  .bottom-bar .right { gap: 0; }

  /* Compact dropdown items */
  .dropdown-menu li { padding: 5px 9px; }
}

/* Ultra-small devices (~360px width) */
@media screen and (max-width: 380px) {
  :root {
    /* Free more space around content and bars */
    --spacing-main-padding: 8px;
    --spacing-bar-padding: 4px 6px;
    --spacing-bar-padding-lg: 5px 7px;
    /* Make quote significantly larger now that buttons are ultra compact */
    --page-quote-min-size: 2.2rem;
    --page-quote-pref-size: 11.5vw;
    --page-quote-max-size: 3.2rem;
  }

  .quote__text,
  #quoteText {
    line-height: 1.28;
    margin-bottom: 14px;
  }

  .header-btn, .footer-btn { padding: 2px 6px; margin: 1px; font-size: 0.8rem; }
  .actions { gap: 2px; }
  .icon-btn { font-size: 0.78rem; }
  .icon-btn svg { width: 16px; height: 16px; }
  .top-bar, .bottom-bar { gap: 0; }
  .top-bar .left,
  .top-bar .right,
  .bottom-bar .left,
  .bottom-bar .right { gap: 0; }
  .dropdown-menu li { padding: 4px 8px; }
}

/* Header & Footer Buttons/Links */
.header-btn, .footer-btn {
  background: transparent;
  border: 1px solid var(--color-btn-border);
  padding: var(--spacing-bar-padding);
  margin: 4px;
  font-size: var(--font-size-btn);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none; /* For <a> tags */
  color: var(--color-link); /* For <a> tags */
  border-radius: var(--radius-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-btn:hover, .footer-btn:hover {
  background: var(--color-btn-bg-hover);
  border-color: #999;
  color: var(--color-btn-hover);
}
.export-card {
  width: 1080px;
  height: 1080px;
  padding: var(--spacing-export-padding);
  box-sizing: border-box;
  font-family: var(--font-family-serif);
  font-size: var(--font-size-export);
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* space content vertically so quote uses top 2/3 */
  align-items: center;
  text-align: center;
  background: white;
  color: black;
}

/* Export Text Elements */
.export-quote-section {
  flex: 2 1 66.66%;
  width: 100%;
  display: flex;
  align-items: center; /* vertically center the quote within its section */
  justify-content: center;
}

.export-quote {
  margin-bottom: var(--export-quote-margin-bottom);
  font-size: var(--export-text-size);
  line-height: var(--export-text-line-height);
}

.export-divider {
  width: 100%;
  border: none;
  border-top: 2px solid rgba(0,0,0,0.3);
  margin: 8px 0 16px;
}

.export-meta {
  flex: 1 1 33.33%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.export-source {
  font-size: var(--export-source-size);
  opacity: 0.9;
  font-style: italic;
}

.export-author {
  font-size: var(--export-author-size);
}

.export-url {
  font-size: var(--export-url-size);
  margin-top: 40px;
  color: var(--export-url-color);
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.font-bold {
  font-weight: bold;
}

.font-italic {
  font-style: italic;
}

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

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

/* Responsive Media Queries */
@media screen and (max-width: 1024px) {
  .export-card {
    width: 800px;
    height: 800px;
  }
}

@media screen and (max-width: 768px) {
  .export-card {
    width: 600px;
    height: 600px;
  }
}

@media screen and (max-width: 480px) {
  .export-card {
    width: 400px;
    height: 400px;
  }
}
