import { css } from 'lit'

export default css`
  :host {
    display: block;
    height: 56px;
    outline: none;
    cursor: default;
    position: relative;

    --md-focus-ring-shape-end-end: 0px;
    --md-focus-ring-shape-end-start: 0px;
    --md-focus-ring-shape-start-end: 0px;
    --md-focus-ring-shape-start-start: 0px;
  }

  :host([disabled]) {
    cursor: not-allowed;
  }

  :host([hidden]) {
    display: none;
  }

  :host([lines='two']),
  :host([lines='one'][image='image']) {
    height: 72px;
  }

  :host([lines='three']),
  :host([lines='one'][image='video']) {
    height: 88px;
  }

  .surface {
    height: inherit;
    position: relative;

    display: flex;
    align-items: center;
  }

  .surface,
  .content {
    width: 100%;
  }

  .container {
    position: absolute;
    inset: 0;
    z-index: 1;
  }

  .content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 8px 16px 8px 16px;
  }

  .ripple {
    z-index: 3;
  }

  :host([image='video']) .content {
    /* The spec says the right padding is 24px but counting from the checkbox check border.
      This does not include spacing presented by the checkbox itself (18 box, 40px state layer)
   */
    padding: 12px 16px 12px 0px;
  }

  .headline {
    color: var(--md-sys-color-on-surface);

    font-family: var(--md-sys-typescale-body-large-font);
    font-weight: var(--md-sys-typescale-body-large-weight);
    font-size: var(--md-sys-typescale-body-large-size);
    letter-spacing: var(--md-sys-typescale-body-large-tracking);
    line-height: var(--md-sys-typescale-body-large-height);

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    display: flex;
    align-items: center;
  }

  .supporting-text {
    color: var(--md-sys-color-on-surface-variant);

    font-family: var(--md-sys-typescale-body-medium-font);
    font-weight: var(--md-sys-typescale-body-medium-weight);
    font-size: var(--md-sys-typescale-body-medium-size);
    letter-spacing: var(--md-sys-typescale-body-medium-tracking);
    line-height: var(--md-sys-typescale-body-medium-height);

    overflow: hidden;
  }

  .supporting-text ::slotted(*),
  slot[name='end-text']::slotted(*) {
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  slot[name='end-text']::slotted(*) {
    /* this is to make up to the 24px right padding defined in the spec. */
    margin-right: 8px;
    margin-left: 16px;
  }

  :host([lines='three']) .supporting-text {
    height: calc(2 * var(--md-sys-typescale-body-medium-height, 1.1));
  }

  :host([lines='three']) .supporting-text ::slotted(*) {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  :host([lines='two']) .supporting-text ::slotted(*) {
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .trailing-supporting-text {
    color: var(--md-sys-color-on-surface-variant);

    font-family: var(--md-sys-typescale-body-small-font);
    font-weight: var(--md-sys-typescale-body-small-weight);
    font-size: var(--md-sys-typescale-body-small-size);
    letter-spacing: var(--md-sys-typescale-body-small-tracking);
    line-height: var(--md-sys-typescale-body-small-height);
  }

  :host slot[name='end']::slotted(*) {
    color: var(--md-sys-color-on-surface-variant);
    fill: var(--md-sys-color-on-surface-variant);
    margin-left: 16px;
  }

  :host slot[name='start']::slotted(*) {
    display: block;
    margin-right: 16px;
  }

  :host([image='icon']) slot[name='start']::slotted(*) {
    width: 24px;
    height: 24px;
  }

  :host([image='avatar']) slot[name='start']::slotted(*) {
    width: 40px;
    height: 40px;
  }

  :host([image='image']) slot[name='start']::slotted(*) {
    width: 56px;
    height: 56px;
  }

  :host([image='video']) slot[name='start']::slotted(*) {
    width: 114px;
    height: 64px;
  }

  .body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  :host(.highlight) .state {
    background-color: var(--md-sys-color-on-surface);
    opacity: var(--md-sys-state-hover-state-layer-opacity);
    position: absolute;
    inset: 0;
    z-index: 1;
  }

  :host(.select) .state {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    opacity: var(--md-sys-state-focus-state-layer-opacity);
    position: absolute;
    inset: 0;
    z-index: 1;
  }

  :host([static]:hover) .state {
    background-color: var(--md-sys-color-on-surface);
    opacity: var(--md-sys-state-hover-state-layer-opacity);
    position: absolute;
    inset: 0;
    z-index: 1;
  }
`
