/* ==========================================================================
   Komaki Roy EV - Comprehensive Global Styles (Requires root.css)
   ========================================================================== */

/* --- 1. Modern CSS Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--clr-text-main);
  background-color: var(--clr-bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Custom Text Selection */
::selection {
  background-color: var(--clr-selection-bg);
  color: var(--clr-selection-text);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--clr-bg-base);
}
::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--clr-primary);
}

/* --- 2. Base Typography & Inline Elements --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.1;
  color: var(--clr-text-main);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--fs-4xl);
}
h2 {
  font-size: var(--fs-3xl);
}
h3 {
  font-size: var(--fs-2xl);
}
h4 {
  font-size: var(--fs-xl);
}
h5 {
  font-size: var(--fs-lg);
}
h6 {
  font-size: var(--fs-base);
}

p {
  color: var(--clr-text-muted);
  margin-bottom: var(--space-md);
  max-width: 75ch; /* Optimal reading width */
}

a {
  color: var(--clr-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover,
a:focus-visible {
  color: var(--clr-primary-hover);
  outline: none;
}

a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

strong,
b {
  font-weight: 700;
  color: #ffffff;
}
em,
i {
  font-style: italic;
}
mark {
  background-color: var(--clr-primary-glow);
  color: #ffffff;
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}
small {
  font-size: 0.8em;
}
sub,
sup {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sup {
  top: -0.5em;
}
sub {
  bottom: -0.25em;
}
del,
s {
  text-decoration: line-through;
  color: var(--clr-text-muted);
}
ins,
u {
  text-decoration: underline;
}
abbr[title] {
  border-bottom: 1px dotted var(--clr-text-muted);
  cursor: help;
  text-decoration: none;
}

blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-md) var(--space-lg);
  border-left: 4px solid var(--clr-primary);
  background-color: var(--clr-bg-surface-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: var(--fs-lg);
  font-style: italic;
  color: #ffffff;
}

cite {
  font-style: normal;
  font-size: 0.9em;
  color: var(--clr-text-muted);
}
q {
  quotes: "“" "”" "‘" "’";
}
q::before {
  content: open-quote;
}
q::after {
  content: close-quote;
}

code,
kbd,
samp,
pre {
  font-family:
    ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.875em;
}

code,
kbd {
  background-color: var(--clr-bg-surface-light);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--clr-primary);
}

pre {
  background-color: var(--clr-bg-surface-light);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: 1px solid var(--clr-border);
}
pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

hr {
  box-sizing: content-box;
  height: 0;
  overflow: visible;
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: var(--space-xl) 0;
}

/* --- 3. Lists --- */
ul,
ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
  color: var(--clr-text-muted);
}
li {
  margin-bottom: var(--space-xs);
}
ul ul,
ol ol,
ul ol,
ol ul {
  margin-bottom: 0;
  margin-top: var(--space-xs);
}
dl {
  margin-bottom: var(--space-md);
}
dt {
  font-weight: 700;
  color: #ffffff;
  margin-top: var(--space-sm);
}
dd {
  margin-left: var(--space-lg);
  color: var(--clr-text-muted);
  margin-bottom: var(--space-xs);
}

/* --- 4. Embedded Content & Media --- */
img,
picture,
video,
canvas,
svg,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
  height: auto;
  border-style: none;
}
iframe {
  border: 0;
  width: 100%;
}
figure {
  margin: 0 0 var(--space-md);
}
figcaption {
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  text-align: center;
  margin-top: var(--space-xs);
  padding: var(--space-xs);
}

/* --- 5. Tables --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-bottom: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border);
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}
caption {
  padding-top: var(--space-sm);
  padding-bottom: var(--space-sm);
  color: var(--clr-text-muted);
  text-align: left;
  caption-side: bottom;
}
th,
td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
}
th {
  font-weight: 600;
  color: #ffffff;
  background-color: var(--clr-bg-surface-light);
}
tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* --- 6. Forms & Interactive Elements --- */
form {
  margin-bottom: var(--space-md);
}
fieldset {
  border: 1px solid var(--clr-border);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border-radius: var(--radius-md);
}
legend {
  padding: 0 var(--space-xs);
  color: #ffffff;
  font-weight: 600;
}
label {
  display: inline-block;
  margin-bottom: var(--space-xs);
  color: #ffffff;
  font-size: var(--fs-sm);
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="month"],
input[type="week"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  background-color: var(--clr-bg-surface-light);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-main);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--fs-base);
  transition:
    border-color var(--transition-smooth),
    box-shadow var(--transition-smooth);
  appearance: none; /* Removes native styling for a consistent look */
}

textarea {
  resize: vertical;
  min-height: 120px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-glow);
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

input[type="checkbox"],
input[type="radio"] {
  box-sizing: border-box;
  padding: 0;
  margin-right: 0.5rem;
  accent-color: var(--clr-primary);
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
}

input[type="file"] {
  padding: 0.5rem 0;
  background: transparent;
  border: none;
}
input[type="file"]::file-selector-button {
  background-color: var(--clr-bg-surface-light);
  color: #ffffff;
  border: 1px solid var(--clr-border);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  margin-right: var(--space-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
input[type="file"]::file-selector-button:hover {
  background-color: var(--clr-primary);
  border-color: var(--clr-primary);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--clr-primary);
}

/* Custom Select Arrow */
select {
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem top 50%;
  background-size: 0.65rem auto;
}
select option {
  background-color: var(--clr-bg-base);
  color: #ffffff;
}

button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  background-color: var(--clr-primary);
  color: #ffffff;
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-smooth),
    background-color var(--transition-fast);
}
button:hover,
input[type="submit"]:hover {
  background-color: #ffffff;
  color: var(--clr-bg-base);
  box-shadow: 0 8px 25px var(--clr-primary-glow);
  transform: translateY(-2px);
}
button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

progress,
meter {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background-color: var(--clr-bg-surface-light);
}
progress::-webkit-progress-bar {
  background-color: var(--clr-bg-surface-light);
}
progress::-webkit-progress-value {
  background-color: var(--clr-primary);
}
progress::-moz-progress-bar {
  background-color: var(--clr-primary);
}

details {
  background-color: var(--clr-bg-surface-light);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
}
summary {
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  list-style: none; /* Removes default arrow in some browsers */
  outline: none;
}
summary::-webkit-details-marker {
  display: none;
}
summary::after {
  content: "+";
  float: right;
  color: var(--clr-primary);
  font-size: 1.2em;
  line-height: 1;
}
details[open] summary::after {
  content: "-";
}
details p {
  margin-top: var(--space-sm);
  margin-bottom: 0;
}

dialog {
  margin: auto;
  padding: var(--space-lg);
  background-color: var(--clr-bg-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  color: #ffffff;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

/* --- 7. Layout Containers --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-md);
}
.container-fluid {
  width: 100%;
  padding-inline: var(--space-md);
}
.section-padding {
  padding-block: var(--space-2xl);
}

/* --- 8. Responsive Breakpoints (Handling Specific Overrides) --- */

/* Laptops / Small Desktops */
@media (max-width: 1024px) {
  body {
    font-size: 16px;
  }
}

/* Tablets */
@media (max-width: 768px) {
  table {
    white-space: normal;
  }
  blockquote {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--fs-base);
  }
  input[type="text"],
  input[type="email"],
  textarea,
  select {
    padding: 0.6rem 0.8rem;
  }
  .btn-primary,
  button,
  input[type="submit"] {
    width: 100%;
    text-align: center;
    display: block;
  }
}

/* Large Mobile Devices */
@media (max-width: 480px) {
  .container {
    padding-inline: var(--space-sm);
  }
  form fieldset {
    padding: var(--space-sm);
  }
  dialog {
    width: 90vw;
    padding: var(--space-md);
  }
  ul,
  ol {
    padding-left: var(--space-md);
  }
}

/* Extra Small Phones */
@media (max-width: 320px) {
  h1 {
    font-size: 2rem;
  }
  h2 {
    font-size: 1.75rem;
  }
  .btn-primary,
  button {
    font-size: 0.75rem;
    padding: 0.6rem 1rem;
  }
}
